Latest version of npm required to install

Viewed 4994

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 npm@7.4.3` 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 react-scripts@3.4.1 -g --silent

COPY . ./

CMD ["npm", "start"]

when i add there 'RUN npm install -g npm@7.4.3' - 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 npm@7.4.3` to update!
npm notice 
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: prop-types@15.6.0
npm ERR! node_modules/prop-types
npm ERR!   peer prop-types@"<=15.6.0" from check-prop-types@1.1.2
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: prop-types@15.7.2
npm ERR! node_modules/prop-types
npm ERR!   peer prop-types@"^15.7.2" from react-leaflet-search@2.0.1
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
1 Answers

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 npm@7.19.1

Related