Question

How to install npm and pm2 using putty if these errors occur?

root@ShaliniSite:/home/nodeapp# sudo npm install -g pm2
▐ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine pm2@5.2.2: wanted: {"node":">=10.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"})
npm ERR! Linux 4.15.0-189-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "pm2"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>
WARN engine pidusage@3.0.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine mkdirp@1.0.4: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine semver@7.3.8: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})

npm ERR! Please include the following file with any support request:
npm ERR!     /home/nodeapp/npm-debug.log

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
January 4, 2023

Hello @shaliniv37

You can try the following command

  1. npm install pm2 -g && pm2 update

pm2 update is necessary in order to refresh the PM2 daemon.

https://pm2.io/docs/runtime/guide/installation/

Regards

KFSys
Site Moderator
Site Moderator badge
January 3, 2023

Hi @shaliniv37,

There is no need to install pm2 with npm install you can just use apt install pm2.

Here is an article that could help you configure a NodeJS environment with PM2:

https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up