npm

npm, and Solutions.

ERESOLVE unable to resolve dependency tree

: npm install

:(npm 7+ )

Solutions:

  1. : npm install --legacy-peer-deps
  2. : npm install --force
  3. :,
  4. overrides: package.json "overrides"

: New,

EACCES: permission denied

: npm install -g

:npm root

Solutions:

  1. Recommended: nvm Node()
  2. npm prefix: mkdir ~/.npm-global && npm config set prefix ~/.npm-global
  3. ~/.npm-global/bin PATH
  4. : sudo npm install -g(Recommended)

: nvm Node.js,

npm ERR! network request to https://registry.npmjs.org failed

: npm install

:, DNS,

Solutions:

  1. : npm config set registry https://registry.npmmirror.com
  2. : npm config set proxy http://127.0.0.1:7890
  3. : npm cache clean --force && npm install
  4. DNS: nslookup registry.npmjs.org

: Developer npmmirror

Error: Cannot find module 'xxx'

: Node.js

:, node_modules,

Solutions:

  1. New: rm -rf node_modules && npm install
  2. package.json : npm ls <package>
  3. command: npm install -g <package>
  4. require/import

: package.json,

npm WARN EBADENGINE Unsupported engine

: npm install Node.js

:Node.js

Solutions:

  1. : npm info <package> engines
  2. Node.js: nvm install <version> && nvm use <version>
  3. (): npm install --ignore-engines
  4. .nvmrc Node

:.nvmrc, Node.js