Latest version of npm required to install - node.js

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

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

npm install npm#{latest version}
You can use this, it worked for me just now

Related

Installing dependencies with npm-peer-dependencies

I am trying to install the required node_modules for a small project running Angular 11 using npm install
My goal is get the project to work locally after downloading it from GitHub. I have already installed the latest version of the Angular CLI.
After running the install command I tried npm start.
I was expecting that after running the install and start command to be able to run the project locally.
However the actual result I get after running the install command is the following list of errors:
> ng serve
An unhandled exception occurred: Cannot find module '#angular/compiler'
Require stack:
\node_modules\#angular\compiler-cli\index.js
\node_modules\#ngtools\webpack\src\angular_compiler_plugin.js
\node_modules\#ngtools\webpack\src\index.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\typescript.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\index.js
\node_modules\#angular-devkit\build-angular\src\browser\index.js
\node_modules\#angular-devkit\build-angular\src\dev-server\index.js
\node_modules\#angular-devkit\architect\node\node-modules-architect-host.js
\node_modules\#angular-devkit\architect\node\index.js
\node_modules\#angular\cli\models\architect-command.js
\node_modules\#angular\cli\commands\serve-impl.js
\node_modules\#angular-devkit\schematics\tools\export-ref.js
\node_modules\#angular-devkit\schematics\tools\index.js
\node_modules\#angular\cli\utilities\json-schema.js
\node_modules\#angular\cli\models\command-runner.js
\node_modules\#angular\cli\lib\cli\index.js
\node_modules\#angular\cli\lib\init.js
\node_modules\#angular\cli\bin\ng
See "angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the #0.0.16 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
The problem is that this Angular project also has peer dependencies. I installed npm-install-peers package but it seems that simply running npm install afterwards will not install the required peer dependencies.
What should I do next to get this Angular project installed locally ?
The issue you are facing is likely because angular cli or npm-peer-dependencies are not installed globally on your machine.
The steps that you should take are to make sure of them are globally installed.
To install packages globally you need run npm install -g <package_name>
npm docs link
In your case for angular cli you should run
npm i -g #angular/cli#11.2.15 and npm install -g npm-peer-dependencies.
Then run npm start.

Issue when I try to execute npm install

when I run the command npm install, it displays this error:
[log#server:www]$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: vue#2.6.14
npm ERR! node_modules/vue
npm ERR! dev vue#"^2.5.17" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.0.0" from vee-validate#4.4.4
npm ERR! node_modules/vee-validate
npm ERR! vee-validate#"^4.2.3" 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-06-09T01_39_40_386Z-debug.log
I wonder, how can I fix it? What does it mean?
Thanks
It looks like you're trying to install vee-validate version 4.0 in a Vue 2.x application. You can see the compatible version in the vee-validate repo.
How to fix:
Option 1:
Install an older version of Vee-validate (v2 or v3).
First, you'll need to uninstall the version you currently have installed (I'm assuming you installed vee-validate#next since that's the doc recommendation)
npm uninstall vee-validate#next
You can then find the list of versions available with
npm info vee-validate versions
Finally, install an older version with
npm install vee-validate#3.4.9
Replace the 3.4.9 with whatever version you would like to install - as of the time of writing, 3.4.9 is the latest stable tag
Option 2:
Upgrade from Vue 2 to Vue 3 following the upgrade guide.
Note that this is still a work in progress and may have some stability issues and depending on the state of the project I would consider using the above option for the time being.
Step:-1 Make sure node.js is installed on your system. You can check with the command npm --version or node --version
Step:-2 Clear npm cache. run this command npm cache clear -f
Step:-3 Then try to run npm install

Getting error on angular CLI isntallation

I am trying to install angular/cli on my windows10 64-bit machine, But I am getting the following error:
npm ERR! code ENOGIT
npm ERR! Error while executing:
npm ERR! undefined ls-remote -h -t ssh://git#github.com/angular/cli.git
npm ERR!
npm ERR! undefined
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-03-19T08_13_51_165Z-debug.log
I am trying to execute the following command:
npm install -g angular/cli
Following are the specifications:
node --version
v10.15.1
npm --version
6.4.1
Things tried till now as suggested in different posts and forums:
Tried running command prompt as Administrator
Setting the network settings(set https-proxy and proxy).
npm cache clean --force
I don't have git installed on my machine, but is it necessary and mandatory?
I have installed angular previously also(Angular 4) but at that time everything was fine.
Need help.
You should install #angular/cli (note the #)
npm i #angular/cli
This one does not require git to be installed.
I have to admit that this naming is confusing.

Installing github hosted npm dependencies with Docker

I'm trying to dockerize a project, but I'm having issues in the npm install process with my Gulp 4 dependency. I'm using Gulp 4 because we needed some of the new features, but all the instructions I've seen for using the prerelease version of Gulp 4 is to use the github branch url. Here is the offending dependency:
"gulp": "github:gulpjs/gulp#4.0",
And here is the error I get when I try to run docker build -t user/project .:
npm ERR! Error: No compatible version found: gulp#'github:gulpjs/gulp#4.0'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.7","0.0.8","0.0.9","0.1.0","0.2.0","1.0.0","1.1.0","1.2.0","1.2.1","2.0.0","2.0.1","2.1.0","2.2.0","2.3.0","2.4.0","2.4.1","2.6.0","2.6.1","2.7.0","3.0.0","3.1.1","3.1.2","3.1.3","3.1.4","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.3.0","3.3.1","3.3.2","3.3.4","3.4.0","3.5.0","3.5.1","3.5.2","3.5.5","3.5.6","3.6.0","3.6.1","3.6.2","3.7.0","3.8.0","3.8.1","3.8.2","3.8.3","3.8.4","3.8.5","3.8.6","3.8.7","3.8.8","3.8.9","3.8.10","3.8.11","3.9.0","3.9.1"]
npm ERR! at installTargetsError (/usr/lib/node_modules/npm/lib/cache.js:719:10)
npm ERR! at /usr/lib/node_modules/npm/lib/cache.js:638:10
npm ERR! at saved (/usr/lib/node_modules/npm-registry-client/lib/get.js:148:7)
npm ERR! at /usr/lib/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:108:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.19.0-51-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /src
npm ERR! node -v v0.10.42
npm ERR! npm -v 1.3.6
This is the Dockerfile I'm currently using:
# Using CentOS
FROM centos:centos6
# Enable Extra Packages for Enterprise Linux (EPEL) for CentOS
RUN yum install -y epel-release
# Install Node.js and npm
RUN yum install -y nodejs npm
COPY package.json /src/package.json
# Install app dependencies
RUN cd /src; npm install
# Bundle app source
COPY . /src
# Run server
EXPOSE 8080
CMD ["npm", "start"]
Is there a way to get Docker to be ok with the github url? Or is there an alternate way to include the dependency that Docker would be happy with?
The issue was caused by older version of node available on the base image.
The version of node was not compatible with gulp version.
A base image with newer version of node resolved the issue.

install socket.io on ubuntu

I'm working on a real time application and I'm using third party to do it.
But now I have to use node.js with socket.io instead of third party .
I installed the node.js (v0.4.12) correctly and I check it using command node -v .
but when I was installed the socket.io using npm install socket.io command I got this error .
npm ERR! install failed Error: Required package: options(latest) not found. (Found: ["0.0.3"])
npm ERR! install failed (required by: ws#0.4.23)
npm ERR! install failed at /usr/share/npm/lib/build.js:192:19
npm ERR! install failed at cb (/usr/share/npm/lib/utils/graceful-fs.js:32:9)
npm ERR! Error: Required package: options(latest) not found. (Found: ["0.0.3"])
npm ERR! (required by: ws#0.4.23)
npm ERR! at /usr/share/npm/lib/build.js:192:19
npm ERR! at cb (/usr/share/npm/lib/utils/graceful-fs.js:32:9)
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues>
npm ERR! or email it to <npm-#googlegroups.com>
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm not ok
How I can solve it?
I ran those commands and it worked:
sudo npm install -g n
sudo n 0.8.15
sudo npm install socket.io
You're trying to install it without a package.json file, and in your solution you installed it globally, which is usually not what you want for socket.io.
Instead, you should include a package.json file in your working directory and either run:
> npm install socket.io --save
which will automatically append it to package.json, or your you can physically include it in the dependencies and then just run:
> npm install
It worked:
1) sudo npm install -g n
2) sudo n 0.8.15
3) sudo npm install socket.io
In some cases if you are behind a proxy and try to run:
sudo npm install socket.io
you may end up in getting error -
npm ERR! Error: shasum check failed for /tmp/npm-1393245157089/1393245157089-0.6057841922156513/tmp.tgz
npm ERR! Expected: 3bab0444e49b55fbbc157424dbd41aa375a51a76
npm ERR! Actual: dae95023b71f7d06533f7c35a7d0c3b0cf729f42
then run the following
sudo npm --proxy=http://"your_proxy":"your_port" install socket.io

Resources