[英]Cant see npm version on ubuntu because of Error: Cannot find module 'semver'
I reinstalled ubuntu on my machine and after that installed node, react, npm, when i tried to start old project and run into same error when i started the project but also when i tried to see version of npm.我在我的机器上重新安装了 ubuntu 并在安装节点之后做出反应,npm,当我尝试启动旧项目并在启动项目时遇到相同的错误时,以及当我尝试查看 ZBB30E85411B546DF41296726AB4 的版本时。
node:internal/modules/cjs/loader:927
throw err;
^
Error: Cannot find module 'semver'
Require stack:
- /usr/share/npm/lib/utils/unsupported.js
- /usr/share/npm/bin/npm-cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/usr/share/npm/lib/utils/unsupported.js:2:14)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/share/npm/lib/utils/unsupported.js',
'/usr/share/npm/bin/npm-cli.js'
]
}
I uninstalled and installed npm again but it didnt help我再次卸载并安装了 npm 但没有帮助
Try this link anotehr SO post试试这个链接anotehr SO post
Basically what they are doing is the below steps:基本上他们正在做的是以下步骤:
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --force node
brew install node
replace brew
with respective package manager用相应的 package 管理器替换
brew
You generally don't need to install npm
separately.一般不需要单独安装
npm
。 npm
is bundled with node
and the version that is bundled will generally work with the version of node
you are running. npm
与node
捆绑在一起,捆绑的版本通常与您正在运行的node
版本一起使用。 If you install npm
separately, you run the risk of installing an incompatible version of node
.如果您单独安装
npm
,您将面临安装不兼容版本node
的风险。
So uninstall npm
.所以卸载
npm
。 See if you still have an npm
available.看看您是否还有可用的
npm
。 If not, uninstall and reinstall node
.如果没有,请卸载并重新安装
node
。 Do not install npm
separately (unless it is using npm
itself to update to a newer version of npm
with npm install -g npm
.) Do not install
npm
separately (unless it is using npm
itself to update to a newer version of npm
with npm install -g npm
.)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.