vue3启动时报错 Cannot find module ‘vue-loader-v16/package.json‘

最近在研究vue3,但是在启动的时候报一下错误,再次记录一下:

 ERROR  Error: Cannot find module 'vue-loader-v16/package.json'
Error: Cannot find module 'vue-loader-v16/package.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at api.chainWebpack.webpackConfig (/Users/zhouqiang/Desktop/vue3-3/node_modules/@vue/cli-service/lib/config/base.js:114:23)
    at webpackChainFns.forEach.fn (/Users/zhouqiang/Desktop/vue3-3/node_modules/@vue/cli-service/lib/Service.js:236:40)
    at Array.forEach (<anonymous>)
    at Service.resolveChainableWebpackConfig (/Users/zhouqiang/Desktop/vue3-3/node_modules/@vue/cli-service/lib/Service.js:236:26)
    at Service.resolveWebpackConfig (/Users/zhouqiang/Desktop/vue3-3/node_modules/@vue/cli-service/lib/Service.js:240:48)
    at PluginAPI.resolveWebpackConfig (/Users/zhouqiang/Desktop/vue3-3/node_modules/@vue/cli-service/lib/PluginAPI.js:132:25)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue3-3@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vue3-3@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

1. 升级npm

npm i -g npm

使用cnpm的也要升级一下cnpm

cnpm i -g cnpm

 

2. 重新安装node_modules依赖包

rm -rf node_modules // 先删除原来的依赖包

cnpm i // 重新安装

 

3. 重新下载

cnpm i -D vue-loader-v16

 

然后就可以了

 

上一篇:“推拉搜索”解决受约束的多目标优化问题


下一篇:vue3项目报错 Error: Cannot find module ‘vue-loader-v16/package.json‘