简体   繁体   English

错误在(npm run dev)命令中找不到模块'semver'

[英]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)然后再次安装nodejsnpm (最新版本)

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.

相关问题 Npm 安装找不到模块“semver” - Npm install cannot find module 'semver' 安装 Npm 时找不到模块“semver” - Cannot find module 'semver' When installing Npm 由于错误:找不到模块“semver”,在 ubuntu 上看不到 npm 版本 - Cant see npm version on ubuntu because of Error: Cannot find module 'semver' 错误:在 Next 项目上运行 npm run dev 时找不到模块“D:\next\dist\bin\next” - Error: Cannot find module 'D:\next\dist\bin\next' when running npm run dev on a Next project 当我 npm 运行开发时出现错误:找不到模块“postcss/lib/parser” - When I npm run dev I get an error: cannot find module “postcss/lib/parser” module.js:540错误:找不到模块'semver' - module.js:540 Error: Cannot find module 'semver' Elastic Beanstalk上传和部署错误:错误:找不到模块“ semver” - Elastic Beanstalk upload and deploy error: Error: Cannot find module 'semver' 错误:找不到模块请验证 package.json 在 npm 上运行开发时存在有效的“主”条目 nuxtjs 错误 - Error: Cannot find module Please verify that the package.json has a valid "main" entry nuxtjs error on npm run dev 如何修复:运行 npm 运行构建命令时找不到模块错误 - How to fix : cannot find Module error in while running the npm run build command Laravel 7 React 脚手架抛出错误:运行“npm run dev”时找不到模块“vue-template-compiler” - Laravel 7 React Scaffolding throwing Error: Cannot find module 'vue-template-compiler' when running "npm run dev"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM