Unable to start vue due to issue with npm run serve
See original GitHub issueVersion
3.9.3
Environment info
Environment Info:
System:
OS: macOS 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Binaries:
Node: 10.16.0 - /usr/local/bin/node
Yarn: Not Found
npm: 6.9.0 - /usr/local/bin/npm
Browsers:
Chrome: 75.0.3770.142
Firefox: Not Found
Safari: 12.1.2
npmPackages:
@vue/babel-helper-vue-jsx-merge-props: 1.0.0
@vue/babel-plugin-transform-vue-jsx: 1.0.0
@vue/babel-preset-app: 3.9.2
@vue/babel-preset-jsx: 1.1.0
@vue/babel-sugar-functional-vue: 1.0.0
@vue/babel-sugar-inject-h: 1.0.0
@vue/babel-sugar-v-model: 1.0.0
@vue/babel-sugar-v-on: 1.1.0
@vue/cli-overlay: 3.9.0
@vue/cli-plugin-babel: ^3.9.0 => 3.9.2
@vue/cli-plugin-eslint: ^3.9.0 => 3.9.2
@vue/cli-service: ^3.9.0 => 3.9.3
@vue/cli-shared-utils: 3.9.0
@vue/component-compiler-utils: 2.6.0 (3.0.0)
@vue/preload-webpack-plugin: 1.1.0
@vue/web-component-wrapper: 1.2.0
eslint-plugin-vue: ^5.0.0 => 5.2.3 (4.7.1)
vue: ^2.6.10 => 2.6.10
vue-eslint-parser: 2.0.3 (5.0.0)
vue-hot-reload-api: 2.3.3
vue-loader: 15.7.1
vue-style-loader: 4.1.2
vue-template-compiler: ^2.6.10 => 2.6.10
vue-template-es2015-compiler: 1.9.1
npmGlobalPackages:
@vue/cli: 3.9.3
Steps to reproduce
vue create vue-test cd vue-test npm run serve
What is expected?
Normal running of vue process and to be able to see a web page with the vue information attached to it.
What is actually happening?
Receiving an error from Vue claiming that it cannot get access to a port. The port is available and have performed a check on MacOS to ensure that nothing is listening to or blocking the port
0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/Cellar/node/12.6.0/bin/node’,
1 verbose cli ‘/usr/local/bin/npm’,
1 verbose cli ‘run’,
1 verbose cli ‘serve’ ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose run-script [ ‘preserve’, ‘serve’, ‘postserve’ ]
5 info lifecycle vuetest@0.1.0~preserve: vuetest@0.1.0
6 info lifecycle vuetest@0.1.0~serve: vuetest@0.1.0
7 verbose lifecycle vuetest@0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle vuetest@0.1.0~serve: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/gpierce/Desktop/vuetest/node_modules/.bin:/anaconda3/bin:/anaconda3/condabin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
9 verbose lifecycle vuetest@0.1.0~serve: CWD: /Users/gpierce/Desktop/vuetest
10 silly lifecycle vuetest@0.1.0~serve: Args: [ ‘-c’, ‘vue-cli-service serve’ ]
11 silly lifecycle vuetest@0.1.0~serve: Returned: code: 1 signal: null
12 info lifecycle vuetest@0.1.0~serve: Failed to exec serve script
13 verbose stack Error: vuetest@0.1.0 serve: vue-cli-service serve
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid vuetest@0.1.0
15 verbose cwd /Users/gpierce/Desktop/vuetest
16 verbose Darwin 18.7.0
17 verbose argv “/usr/local/Cellar/node/12.6.0/bin/node” “/usr/local/bin/npm” “run” “serve”
18 verbose node v10.16.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error vuetest@0.1.0 serve: vue-cli-service serve
22 error Exit status 1
23 error Failed at the vuetest@0.1.0 serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
So that’s the problem. You need to append
127.0.0.1 x86_64-apple-darwin13.4.0
to/etc/hosts
or unset it when starting the dev server (HOST= yarn serve
).It is because
process.env.HOST
can be used to specify the default host that the Vue CLI dev server binds to. So when you have this environment variable set (and exported), it will try to bind to it and somehow resolved to23.202.231.169
, which is incorrect, thus the error.Hi, I’m getting a similar error:
I tried echoing my
$HOST
and it was undefined. So of courseprocess.env.HOST
was the same.Could someone give me a tip on how to fix this?