npm run dev 报错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm run dev 报错相关的知识,希望对你有一定的参考价值。

参考技术A 当使用webpack打包时报错会提示

ERROR in ./node_modules/querystring-es3/index.js

Module not found: Error: Can't resolve './decode' in 'C:\wamp64\www\studywebpack\node_modules\querystring-es3'

@ ./node_modules/querystring-es3/index.js 3:33-52

@ ./node_modules/url/url.js

@ (webpack)-dev-server/client?http://localhost:8085

@ multi (webpack)-dev-server/client?http://localhost:8085 ./src/main.js

ERROR in ./node_modules/querystring-es3/index.js

Module not found: Error: Can't resolve './encode' in 'C:\wamp64\www\studywebpack\node_modules\querystring-es3'

@ ./node_modules/querystring-es3/index.js 4:37-56

@ ./node_modules/url/url.js

@ (webpack)-dev-server/client?http://localhost:8085

@ multi (webpack)-dev-server/client?http://localhost:8085 ./src/main.js

ERROR in (webpack)-dev-server/client?http://localhost:8085

Module not found: Error: Can't resolve './overlay' in 'C:\wamp64\www\studywebpack\node_modules\webpack-dev-server\client'

@ (webpack)-dev-server/client?http://localhost:8085 10:16-36

@ multi (webpack)-dev-server/client?http://localhost:8085 ./src/main.js

ERROR in (webpack)-dev-server/client?http://localhost:8085

Module not found: Error: Can't resolve './socket' in 'C:\wamp64\www\studywebpack\node_modules\webpack-dev-server\client'

@ (webpack)-dev-server/client?http://localhost:8085 9:15-34

@ multi (webpack)-dev-server/client?http://localhost:8085 ./src/main.js

ERROR in ./node_modules/url/url.js

Module not found: Error: Can't resolve './util' in 'C:\wamp64\www\studywebpack\node_modules\url'

@ ./node_modules/url/url.js 25:11-28

@ (webpack)-dev-server/client?http://localhost:8085

@ multi (webpack)-dev-server/client?http://localhost:8085 ./src/main.js

ERROR in (webpack)-dev-server/client?http://localhost:8085

Module not found: Error: Can't resolve 'strip-ansi' in 'C:\wamp64\www\studywebpack\node_modules\webpack-dev-server\client'

@ (webpack)-dev-server/client?http://localhost:8085 7:18-39

@ multi (webpack)-dev-server/client?http://localhost:8085 ./src/main.js

ERROR in (webpack)-dev-server/client?http://localhost:8085

Module not found: Error: Can't resolve 'webpack/hot/emitter' in 'C:\wamp64\www\studywebpack\node_modules\webpack-dev-server\client'

@ (webpack)-dev-server/client?http://localhost:8085 214:23-53

@ multi (webpack)-dev-server/client?http://localhost:8085 ./src/main.js

解决方法:在packjson.js中的scripts修改命令--open改为--no-inline

"scripts" :

    "dev" : "webpack-dev-server --no-inline"

npm run dev 报错:missing script:dev

运行vue项目报错

技术图片

 

 检查一下该项目文件夹中的package.json文件

技术图片

 

 在script里,并没有dev,而是serve,应该用npm run serve命令运行vue项目即可。

以上是关于npm run dev 报错的主要内容,如果未能解决你的问题,请参考以下文章

npm run dev遇到报错

npm run dev 报错:missing script:dev

npm run dev报错

npm dev run 报错

vue 运行npm run dev报错

npm run dev报错解决方法