webpack dev 日记
Posted 梦回秦殇
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了webpack dev 日记相关的知识,希望对你有一定的参考价值。
错误日志:
1 AppDataRoaming pm ode_moduleswebpack-cliincli.js:244 2 throw err; 3 ^ 4 5 Error: Cannot find module ‘webpack/lib/RequestShortener‘ 6 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15) 7 at Function.Module._load (internal/modules/cjs/loader.js:497:25) 8 at Module.require (internal/modules/cjs/loader.js:626:17) 9 at require (C:UsersAdministratorAppDataRoaming pm ode_moduleswebpack-cli ode_modulesv8-compile-cachev8-compile-cache.js:159:20) 10 at Object.<anonymous> (D:MyDiskmy-projectwebpack ode_modulesuglifyjs-webpack-plugindistindex.js:19:25)
解决办法:
npm install webpack --save-dev
再次报错:
1 $ npm install webpack 2 npm ERR! code ENOSELF 3 npm ERR! Refusing to install package with name "webpack" under a package 4 npm ERR! also called "webpack". Did you name your project the same 5 npm ERR! as the dependency you‘re installing? 6 npm ERR! 7 npm ERR! For more information, see: 8 npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
原因是 package.json 文件中的 name 为 webpack,所以避免项目名称与插件名称重复
以上是关于webpack dev 日记的主要内容,如果未能解决你的问题,请参考以下文章
self_vue@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`(示例代码