vue-cli: Building generated project failed due to vue-cli-service command not found
I created a new Vue project using the vue create
command. I managed to build it properly on my MacOS platform, but on a CentOS 6.9 platform the build fails with the following error message:
sh: vue-cli-service: command not found
I found a workaround by modifying package.json
as follows:
"scripts": {
"serve": "./node_modules/\\@vue/cli-service/bin/vue-cli-service.js serve --open",
"build": "./node_modules/\\@vue/cli-service/bin/vue-cli-service.js build",
"lint": "./node_modules/\\@vue/cli-service/bin/vue-cli-service.js lint"
},
Version
3.0.0-beta.6
Reproduction link
This is random link, do not open! I cannot reproduce in these places. https://jsfiddle.net/chrisvfritz/50wL7mdz/
Steps to reproduce
Install latest npm, latest vue-cli and try to build a Vue project in CentOS 6.9
What is expected?
The build should succeed
What is actually happening?
$ npm run build
> moo_frontend@1.0.0 build /mnt/partition/home/photoccino/src/apc-tools/moo/frontend
> vue-cli-service build
sh: vue-cli-service: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! moo_frontend@1.0.0 build: `vue-cli-service build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the moo_frontend@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/photoccino/.npm/_logs/2018-04-10T06_37_11_606Z-debug.log
$ cat /home/photoccino/.npm/_logs/2018-04-10T06_37_11_606Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm@5.8.0
3 info using node@v8.11.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle moo_frontend@1.0.0~prebuild: moo_frontend@1.0.0
6 info lifecycle moo_frontend@1.0.0~build: moo_frontend@1.0.0
7 verbose lifecycle moo_frontend@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle moo_frontend@1.0.0~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/partition/home/photoccino/src/apc-tools/moo/frontend/node_modules/.bin:/usr/local/bin:/usr/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/photoccino/bin
9 verbose lifecycle moo_frontend@1.0.0~build: CWD: /mnt/partition/home/photoccino/src/apc-tools/moo/frontend
10 silly lifecycle moo_frontend@1.0.0~build: Args: [ '-c', 'vue-cli-service build' ]
11 info lifecycle moo_frontend@1.0.0~build: Failed to exec build script
12 verbose stack Error: moo_frontend@1.0.0 build: `vue-cli-service build`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at emitTwo (events.js:126:13)
12 verbose stack at ChildProcess.emit (events.js:214:7)
12 verbose stack at maybeClose (internal/child_process.js:925:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
13 verbose pkgid moo_frontend@1.0.0
14 verbose cwd /mnt/partition/home/photoccino/src/apc-tools/moo/frontend
15 verbose Linux 2.6.32-131.17.1.el6.x86_64
16 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
17 verbose node v8.11.1
18 verbose npm v5.8.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error moo_frontend@1.0.0 build: `vue-cli-service build`
23 error spawn ENOENT
24 error Failed at the moo_frontend@1.0.0 build script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 51
- Comments: 36 (6 by maintainers)
This error was showing up in my CI environment (CodeShip Ubuntu 14.04). The details below got me unstuck.
With the --production flag (or when the NODE_ENV environment is set to production), npm will not install modules listed in devDependencies."
This will load all dev dependencies including @vue/cli-service which may or may not be desirable depending on what environment you are building for.
If anybody is still facing this issue, i was able to solve it on MacOS by installing globally
@vue/cli-service-global
.yarn global add @vue/cli-service-global
npm install -g @vue/cli-service-global
Which popped out when running
vue serve
:Hope it helps, Cheers!
I fixed this by :
EDIT: When typing in " @ and vue/cli together as one word, it removes from the text displayed. For clarity, I’ve added a space between the @ sign and the vue/cli. Don’t copy paste these commands unless you plan on removing the space your self.
Note: working on a windows 10 env
This bug could be related to unstable npm installation due to crash in the installation stage: https://github.com/npm/npm/issues/20295
You may close this ticket if you think there is not further issues related to
vue-cli
The
vue-cli-service
script is installed in my localnode_modules
directory, but the install script does not find it:In
package.json
:This error is occuring for me after a fresh vue cli install and running the command : vue create some_project_name
Error:
🚀 Invoking generators... ERROR Error: Failed to resolve plugin: @vue/cli-service Error: Failed to resolve plugin: @vue/cli-service at Creator.resolvePlugins (C:\Users\sheld\AppData\Roaming\npm\node_modules\@vue\cli\lib\Creator.js:303:15) at Creator.create (C:\Users\sheld\AppData\Roaming\npm\node_modules\@vue\cli\lib\Creator.js:146:32) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7)
Vue CLI version: Vue CLI v3.0.0-beta.14
on ubuntu I fixed this by:
apt-get remove npm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash
nvm install --latest-npm
rm -rf node_modules package-lock.json && npm install
Occurs here as well in Windows 10 env with:
Extra notes:
node_modules/@vue/cli-service
directory existsRunning
vue@2.5.17
on This error occurred for me following the use ofnpm-check-update
(ncu v2.14.2
):To fix this I ran
npm install
in the directory . Things worked after this.+1 But! I do npm run build and again npm run serve. And it’s work!
I think it’s an nvm issue. For me at least switching to a regular node install works, where using nvm gave me the error
I have install
but when I do
vue upgrade
, it still gives me this:🤔 🤔 ❓
my
~/.vuerc
“But! I do npm run build and again npm run serve. And it’s work!”
Same here lol
i have same problem with docker
I also ran into this error when creating a new
@vue/cli
project (3.0.0-beta.16
) with default settings with Node 9.11.1. I resolved the issue using a similar procedure as above:@vue/cli
node_modules
I’m using
n
.I got it working (based on Evan’s hint). Here’s what I did:
nvm
(from v0.32.1 -> v0.33.11)node
(v10.3.0)Based on that, it’s hard to say whether the ultimate cause of the hangup was the version of NVM or the version of Node, but my guess is that it is a Node version issue.