vue项目运行 $ npm run dev 报错解决方案
程序员文章站
2022-05-13 19:34:10
...
vue项目运行 $ npm run dev
报错如下:(原因是8080端口号被占用)
$ npm run dev
> [email protected]1.0.0 dev E:\易先生\vue\Vue 高仿开发饿了么webApp\sell1
> node build/dev-server.js
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::8080
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at Server._listen2 (net.js:1262:14)
at listen (net.js:1298:10)
at Server.listen (net.js:1394:5)
at EventEmitter.listen (E:\易先生\vue\Vue 高仿开发饿了么webApp\sell1\node_modules\[email protected]4.15.3@express\lib\application.js:618:24)
at Object.<anonymous> (E:\易先生\vue\Vue 高仿开发饿了么webApp\sell1\build\dev-server.js:92:22)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:393:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:508:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected]1.0.0 dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected]1.0.0 dev script 'node build/dev-server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sell1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build/dev-server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sell1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sell1
npm ERR! 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\2017-07-28T06_52_21_274Z-debug.log
解决方法:
项目目录下build文件,=> config文件 =>index.js 进行修改如下:
dev: {
env: require('./dev.env'),
port: 8000, // 将端口号修改成你想要修改的端口号
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
// (https://github.com/webpack/css-loader#sourcemaps)
// In our experience, they generally work as expected,
// just be aware of this issue when enabling this option.
cssSourceMap: false
}
推荐阅读
-
项目运行npm run dev浏览器始终报cannot get /
-
解决vue项目运行npm run serve报错的问题
-
详解Vue项目在其他电脑npm run dev运行报错的解决方法
-
vue init初始化项目后 npm run dev报错 10% building modules 1/1 modules 0 activeevents
-
Deepin运行 npm run dev 出错 Error: watch /VueProjects/vue-element-admin-master/mock ENOSPC
-
VUE系列: vue中npm run dev运行项目自动打开浏览器
-
让 vue项目在Linux后台持久运行 npm run dev
-
使用vue-cli初始化项目时运行‘npm run dev’报错
-
npm run dev启动项目报错
-
npm run dev报错解决方案