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
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: node
The version cannot be downgraded directly
- Violent solution: uninstall the existing version and reinstall
- switch with nvm version manager
nvm install
- Download address: https://github.com/coreybutler/nvm-windows/releases
.txt
Add 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/
- Check whether the environment variable is consistent with the local storage location
- test
Open cmd, enter nvm -v, if the following information appears, it is successful
- switch node version
Node version switching
Remember: When using nvm
management node
, you need to uninstall the local first node
, and then install it yourselfnode
Common commands of nvm
- 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
- nvm install installs the latest version of node
- nvm use switch to use the specified version node
- nvm ls lists all versions
- nvm current shows the current version
- nvm alias add aliases to different version numbers
- nvm unalias removes defined aliases
- nvm reinstall-packages reinstalls the npm package with the specified version number globally under the current version node environment
- nvm on open nodejs control
- nvm off close nodejs control
- nvm proxy view settings and proxy
- nvm node_mirror [url] Set or view node_mirror in setting.txt
- nvm uninstall uninstalls the specified version
- nvm use [version] [arch] switch the specified node version and number of digits
- nvm root [path] set and view root path
- nvm version View the current version
Digression
It is not recommended to nvm
switch 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