Error: Cannot find module 'semver'

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]@@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 成功

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章