Michael
Michael

Reputation: 101

Latest version of npm required to install

I'm a newbie in coding so please take it easy on me.

I have project on github, made by softwarehouse - its MVP of an app made with Django Rest framework, React app, Docker.

Now I want to run it on my mac, and there is an issue.

When i run docker-compose.yml i start with docker-compose up, it is instaling all packages untill it goes to the step where it tries to instal npm, and i get an error:

npm notice 
npm notice New patch version of npm available! 7.4.0 -> 7.4.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.4.3>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
ERROR: Service 'pet-frontend' failed to build : The command '/bin/sh -c npm install --silent' returned a non-zero code: 1
Failed to deploy 'Compose: docker-compose.yml': `docker-compose` process finished with exit code 1

I don't know why i cannot instal latest version? I have newest node.js where npm is 7.4.0. How i can force install of 7.4.0 or how to install 7.4.0? so deployment could go further?

__ more info __

frontend dockerfile looks like this:

FROM node:latest

WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH

COPY package.json ./
RUN npm install --silent
RUN npm install [email protected] -g --silent

COPY . ./

CMD ["npm", "start"]

when i add there 'RUN npm install -g [email protected]' - still get the same error

When i run npm without --silent i get this error:

npm notice 
npm notice New patch version of npm available! 7.4.0 -> 7.4.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.4.3>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: [email protected]
npm ERR! node_modules/prop-types
npm ERR!   peer prop-types@"<=15.6.0" from [email protected]
npm ERR!   node_modules/check-prop-types
npm ERR!     dev check-prop-types@"^1.1.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! react-leaflet-search@"^2.0.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/prop-types
npm ERR!   peer prop-types@"^15.7.2" from [email protected]
npm ERR!   node_modules/react-leaflet-search
npm ERR!     react-leaflet-search@"^2.0.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-01-26T10_49_01_333Z-debug.log
ERROR: Service 'petsy-frontend' failed to build : The command '/bin/sh -c npm install' returned a non-zero code: 1
Failed to deploy 'Compose: docker-compose.yml': `docker-compose` process finished with exit code 1

Upvotes: 9

Views: 26428

Answers (5)

Jan Mahbub Milon
Jan Mahbub Milon

Reputation: 11

For Mac,

  • run : sudo su
  • password : Enter your machine password
  • run : npm install npm@latest

It works for me.

Upvotes: 0

Khizer Ali
Khizer Ali

Reputation: 9

Follow the hint by npm notice.

Run npm install -g [email protected] to update!

You can update your npm with latest version by above command.

Upvotes: 1

Ayushi Goyal
Ayushi Goyal

Reputation: 11

npm install npm@latest works for me.

Upvotes: 1

Oluwanifemi
Oluwanifemi

Reputation: 11

npm install npm@{latest version}

You can use this, it worked for me just now

Upvotes: 0

Saikat
Saikat

Reputation: 71

I added the following line before npm install and it worked for me. It picks the latest npm version and install in your directory RUN npm install -g [email protected]

Upvotes: 7

Related Questions