欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Error: Cannot find module 'semver'

程序员文章站 2022-06-01 08:50:09
...

vue工程build时失败,报错如下


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

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\pikachu\Documents\manager-web\node_modules\[email protected][email protected]@@vue\cli-service\bin\vue-cli-service.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build 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:\Users\pikachu\AppData\Roaming\npm-cache\_logs\2019-03-05T08_53_13_258Z-debug.log

Process finished with exit code 1

把这个包安装完,后面还出现js-xxx的各种包,实在是烦
最后我把vue的版本改为最新版本2.6.8,把iview的版本改为最新版本3.3.0,删掉.lock文件,重新cnpm i
好了
build 成功

相关标签: vue