[英]error Cannot find module 'semver' in (npm run dev) command
im using laravel 8 and vuejs to create my website我使用 laravel 8 和 vuejs 创建我的网站
i have this error after run npm run dev
command:运行
npm run dev
命令后出现此错误:
Error: Cannot find module 'semver'
Require stack:
- /usr/share/npm/lib/utils/unsupported.js
- /usr/share/npm/bin/npm-cli.js
...
id tried this solutions:我试过这个解决方案:
sudo apt-get purge nodejs --auto-remove
sudo apt-get purge npm --auto-remove
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* ~/.npm
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/bin/node*
sudo rm -rf /usr/local/include/node*
sudo apt-get purge nodejs npm
sudo apt autoremove
npm i -g semver
and then installed again the nodejs
and npm
(latest version)然后再次安装
nodejs
和npm
(最新版本)
but the error still exist what should i do但是错误仍然存在我该怎么办
There are some modules missing in your /usr/share/npm
.您的
/usr/share/npm
缺少一些模块。 So this will I guess solve the problem所以我猜这会解决问题
cd /usr/share/npm; npm i
If this doesn't work then you can also just go on installing each missing module in /usr/share/npm
.如果这不起作用,那么您也可以继续在
/usr/share/npm
安装每个缺少的模块。
just try to install npm globally, it will install latest version of npm只需尝试全局安装 npm,它将安装最新版本的 npm
sudo npm install -g npm
it worked for me.它对我有用。
该错误基本上是说您缺少该模块,因此您需要以这种方式安装它:
npm install semver
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.