0%

node-npm-command

1. npm 安装报错

问题现象:安装npm包时,报错如下:

1
2
3
4
5
code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: karma-jasmine-html-reporter@1.6.0
npm ERR! Found: jasmine-core@3.6.0

This is caused by dependency conflict, you can try to install the package with --force or --legacy-peer-deps flag. see here for more details.

解决方法

1
npm install --force

or

1
npm install --legacy-peer-deps

2. List global packages

1
2
npm list -g
npm list -g --depth 0 # list all global packages without dependencies

3. Find where nodejs was installed(Windows OS)

1
where node

4. Find outdated packages

1
npm outdated

5. Update all packages

1
npm update