yarn install报错:error @achrinza/[email protected]: The engine “node“ is incompatible with this module

error @achrinza/[email protected]: The engine “node” is incompatible with this module. Expected version “8 || 10 || 12 || 14 || 16 || 17”. Got "18.9.0”

The following error occurs when executing the package installation command

insert image description here

reason

The project environment does not support [email protected]the version and needs to be downgraded to version 8 || 10 || 12 || 14 || 16 || 17

Solution

Note: nodeThe version cannot be downgraded directly

  1. Violent solution: uninstall the existing version and reinstall
  2. switch with nvm version manager

nvm install

  1. Download address: https://github.com/coreybutler/nvm-windows/releases

insert image description here

  1. .txtAdd the following two lines of code to the document

Add configuration, use Taobao image:

node_mirror: https://npm.taobao.org/mirrors/node/

npm_mirror: https://npm.taobao.org/mirrors/npm/

insert image description here

  1. Check whether the environment variable is consistent with the local storage location

insert image description here

  1. test

Open cmd, enter nvm -v, if the following information appears, it is successful

insert image description here

  1. switch node version
    insert image description here

Node version switching

Remember: When using nvmmanagement node, you need to uninstall the local first node, and then install it yourselfnode

Common commands of nvm

  1. nvm nvm list is to find all node versions on this computer
    • nvm list View installed versions
    • nvm list installed View the installed version
    • nvm list available View the versions that can be installed on the network
  2. nvm install installs the latest version of node
  3. nvm use switch to use the specified version node
  4. nvm ls lists all versions
  5. nvm current shows the current version
  6. nvm alias add aliases to different version numbers
  7. nvm unalias removes defined aliases
  8. nvm reinstall-packages reinstalls the npm package with the specified version number globally under the current version node environment
  9. nvm on open nodejs control
  10. nvm off close nodejs control
  11. nvm proxy view settings and proxy
  12. nvm node_mirror [url] Set or view node_mirror in setting.txt
  13. nvm uninstall uninstalls the specified version
  14. nvm use [version] [arch] switch the specified node version and number of digits
  15. nvm root [path] set and view root path
  16. nvm version View the current version

Digression

It is not recommended to nvmswitch nodes, because the following situations will occur, node -v cannot find the node version, and npm in node cannot be used. Of course, this situation exists in my personal trial. If the above situation does not occur, nvm is still available. recommended

Guess you like

Origin blog.csdn.net/weixin_41886421/article/details/128063144