logo

npm

Last Updated: 2022-08-06

npm install

Save to package.json - dependencies section:

$ npm install --save <package-name>

Save to package.json - devDependencies section:

$ npm install --save-dev <package-name>

Disable running script

$ npm config set ignore-scripts true

Note that this may cause npm start to fail

npm outdated

Show outdated packages.

npm update

Update a package

$ npm update gatsby

Trouble Shooting

Error:

npm ERR! Unexpected end of JSON input while parsing near '...

Solution:

$ npm cache clean --force

$ sudo npm i npm -g

$ npm install