npm run dev启动报错:Error: Cannot find module 'semver'

2021-11-24 13:57:05 浏览数 (1)

代码语言:javascript复制
PS C:UserswangtingDesktopWisdom_adminwisdom_admin> npm run dev

> eladmin-web@2.6.0 dev C:UserswangtingDesktopWisdom_adminwisdom_admin
> vue-cli-service serve

internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module 'semver'
Require stack:
- C:UserswangtingDesktopWisdom_adminwisdom_adminnode_modules_@vue_cli-service@3.5.3@@vuecli-servicebinvue-cli-service.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:UserswangtingDesktopWisdom_adminwisdom_adminnode_modules_@vue_cli-service@3.5.3@@vuecli-servicebinvue-cli-service.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\Users\wangting\Desktop\Wisdom_admin\wisdom_admin\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\bin\vue-cli-service.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1        
npm ERR! eladmin-web@2.6.0 dev: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the eladmin-web@2.6.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UserswangtingAppDataRoamingnpm-cache_logs2021-08-06T06_20_38_961Z-debug.log
PS C:UserswangtingDesktopWisdom_adminwisdom_admin> 

遇到这样的报错 需要进行

删除一下node_modules

然后打开vscode编辑器,打开终端,进入到项目目录底下,安装依赖

代码语言:javascript复制
cnpm install

依赖安装完成之后

再次启动就行了

再次启动

代码语言:javascript复制
npm run dev

会发现正常运行了

0 人点赞