vue项目搭建,编译启动常见的问题
1、继承element-ui出现问题,提示以下ERROR in ./src/main.jsModule not found: Error: Can't resolve 'element-ui' in 'D:\Program Files\vue_demo_workspace\online_exam\src'@ ./src/main.js 8:0-35解决方法:npmieleme...
·
1、集成element-ui出现问题,提示以下
ERROR in ./src/main.js
Module not found: Error: Can't resolve 'element-ui' in 'D:\Program Files\vue_demo_workspace\online_exam\src'
@ ./src/main.js 8:0-35
解决方法:
npm i element-ui -s
然后再main.js中配置全局配置
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
2、npm run build提示以下:
D:\Program Files\vue_demo_workspace\online_exam\node_modules\webpack\lib\webpack.js:189
throw new RemovedPluginError(errorMessage);
^
Error: webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead.
at Object.get [as CommonsChunkPlugin] (D:\Program Files\vue_demo_workspace\online_exam\node_modules\webpack\lib\webpack.js:189:10)
at Object.<anonymous> (D:\Program Files\vue_demo_workspace\online_exam\build\webpack.prod.conf.js:87:26)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (D:\Program Files\vue_demo_workspace\online_exam\build\build.js:12:23)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! online_exam@1.0.0 build: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the online_exam@1.0.0 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\Administrator\AppData\Roaming\npm-cache\_logs\2019-09-11T12_32_21_782Z-debug.log
其实就是因为package.json中的依赖配置有问题,配置好依赖就可以了。
3、提示缺少什么模块。
直接输入npm install 模块名 —save
注意:
如果老是提示这种依赖丢失,然后又有这些依赖,可以删除node_modules文件夹,然后再执行npm install或者cnpm install再把依赖下载回来。
更多推荐
已为社区贡献1条内容
所有评论(0)