question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to start vue due to issue with npm run serve

See original GitHub issue

Version

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:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sodateacommented, Jul 28, 2019

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 to 23.202.231.169, which is incorrect, thus the error.

0reactions
Uzay-Gcommented, Oct 27, 2020

Hi, I’m getting a similar error:

13 verbose stack Error: muya-example@0.1.1 serve: vue-cli-service serve 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:315:20) 13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:315:20) 13 verbose stack at maybeClose (internal/child_process.js:1026:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

I tried echoing my $HOST and it was undefined. So of course process.env.HOST was the same.

Could someone give me a tip on how to fix this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to start vue project due to npm run serve issue #5023
Normal running of vue process and to be able to see a web page with the classical vue information attached to it. What...
Read more >
Not working "serve" command for Vue js project - Stack Overflow
Try deleting the node_modules folder and after that run npm i from the cmd. · Then try running npm run serve again and...
Read more >
CLI Service - Vue CLI
Inside a Vue CLI project, @vue/cli-service installs a binary named vue-cli-service . You can access the binary directly as vue-cli-service in ...
Read more >
Running the server and viewing the project - Vue.js Developers
To do that, open up your terminal again and make sure you're in the project directory. Then type... $ npm run serve. Once...
Read more >
start-server-and-test - npm
Starts server, waits for URL, then runs test command; when the tests end, shuts down server. Latest version: 1.15.2, last published: 19 days ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found