npm is known not to run on Node.js v12.22.12. You’ll need to 安装 卸载最下面
ERROR: npm v9.6.2 is known not to run on Node.js v12.22.12. You’ll need to
upgrade to a newer Node.js version in order to use this version of npm. This
version of npm supports the following node versions: `^14.17.0 || ^16.13.0 ||
=18.0.0`. You can find the latest version at https://nodejs.org/.
ERROR:
升级npm后错误提示 下了几个安装包。每次安装都提示。这个。是不是要清除之前的安装缓存?还是把群晖里面的12 8.几版本都卸载掉 不过感觉这个是18.15node 版本卡住 安装不了。
/usr/local/lib/node_modules/npm/lib/utils/exit-handler.js:21
const hasLoadedNpm = npm?.config.loaded
^
SyntaxError: Unexpected token ‘.’
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10) 问题显示补充。
现象】
C:\Users\Administrator>npm -v
npm WARN cli npm v9.1.2 does not support Node.js v14.12.0. You should probably upgrade to a
npm WARN cli newer version of node as we can't make any promises that npm will work with this
npm WARN cli version. This version of npm supports the following node versions: `^14.17.0 ||
npm WARN cli ^16.13.0 || >=18.0.0`. You can find the latest version at https://nodejs.org/.
9.1.2
【原因分析】
npm版本跟node版本不对应,例如这个高于node版本,一般是如下几个原因:
1.来回安装node版本,node没有卸载干净,安装旧版本时会出现这问题
2.安装node后,单独对npm升级过
【解决方法】
1.来回安装node版本,node没有卸载干净,安装旧版本时会出现这问题
解决方法:安装npm对应的node版本后,安装后,通过npm uninstall -g npm回到node默认的npm版本,再卸载node就能卸载干净了。
2.安装node后,单独对npm升级过
执行npm uninstall -g npm命令。
https://stackoverflow.com/search?q=linux+npm+is+known+not+to+run+on+Node.js
https://stackoverflow.com/questions/60035154/npm-is-known-not-to-run-on-node-js-v9-2-1
https://stackoverflow.com/questions/48601423/nodejs-4-2-6-not-getting-updated-to-latest-version
https://github.com/nvm-sh/nvm#installing-and-updating
https://www.freecodecamp.org/news/how-to-update-node-and-npm-to-the-latest-version/
您可以为此( NVM )使用节点版本管理器。 尝试使用以下命令。 使用node时我遇到了apt-get的多个问题,但是下面总是有效。//This will install npm v5.4, this might break if you're using node 4.5 and 4.6 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash //To uninstall a node version nvm uninstall <current version> nvm install 8.5.0 nvm use 8.5.0 //check with node -v
如果您使用docker,最简单的方法是直接使用docker hub中的节点泊坞窗 例如: 第一次拉:docker pull node:6.11.5-wheezy
并将以下内容添加到docker文件中:FROM node:6.11.5-wheezy
You can use Node Version Manager for this (NVM). Try using the following commands. I've had multiple issues with apt-get when using node, but below always works.//This will install npm v5.4, this might break if you're using node 4.5 and 4.6 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash //To uninstall a node version nvm uninstall <current version> nvm install 8.5.0 nvm use 8.5.0 //check with node -v
If you're using it with docker the easiest way would be to directly use the node docker from docker hub eg : First pull :docker pull node:6.11.5-wheezy
And add the following to docker file :FROM node:6.11.5-wheezy
https://www.bbsmax.com/A/Gkz14WrrdR/ linux 卸载安装node npm