vue-cli: vue-cli-service: command not found
Version
3.0.1
Node and OS info
nvm 0.33.1 / Node v8.11.4 / Ubuntu 16.04
Steps to reproduce
npm run build fails because vue-cli-service: command not found
What is expected?
npm run build succeeds
What is actually happening?
npm run build fails because vue-cli-service: command not found
Installed globally with npm install -g @vue/cli@latest
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 70
- Comments: 88 (8 by maintainers)
rm -rf node_modules package-lock.json && npm installworked for mePlease provide a valid reproduction when opening an issue.
https://asciinema.org/a/spTomiYQM8FPUuPhpPucA9S9r
Cannot reproduce on macOS. Have you tried
rm -rf node_modulesandnpm installagain?Yeah, don’t close this issue please. I’m getting this as well.
vue-cli-service: not foundI had a similar situation with Ubuntu 18.04
To fix this situation, I had to add the following line to my
.zshrc(maybe in your case is.bashrc)export PATH="$(yarn global bin):$PATH"Effectively, the
yarn global binis a folder where vue (vue cli 3) was placedThis was a suggestion from a yarn issue
@sodatea please explain how it would be possible to provide a reproduction for this issue.
If you look at https://cli.vuejs.org/guide/cli-service.html it tells you that after installing @vue/cli-service ( which may be part of the standard CLI installation ) then vue-cli-service is available in npm scripts, but that if you want to access it directly then you need to use ./node_modules/.bin/vue-cli-service This worked for me, and I guess you could add ./node_modules/.bin to your $PATH if you were so inclined.
This works fine on my macOS. The issue is on Ubuntu 16.04 with nvm.
Yes, I have tried
rm -rf node_modulesand reinstall.I had an issue when I had NODE_ENV set to production, which was, quite for sure, incorrect for this script to execute. Changed back to development, and everything is fine again.
This is most likely an
npmissue (for not prepending./node_modules/.binto$PATH). So please also try updatingnpmversion.Also, try to call it by npx:
Tried all the options above nothing worked for me
Like, the project repository created by
vue create.Hey! This is the correct solution: you need to install
@vue/cli-servicemodule. Using NPMUsing Yarn
My solution on Ubuntu 20.04:
npm i -g @vue/clirm -rf node_modules package-lock.json && npm installA potentiel issue of this could be that the production build gets heavier because of the additional dependency, which should not be needed in a production, especially if users want to install the app as a PWA. I could fix this on Heroku by using the heroku build hooks as explained here
You can also customize the
heroku-postbuildif you need additional configuration.this works for me
if happened while building docker image, try to remove
NODE_ENV=productionbeforenpm installoryarn install.I did
npm installand that was enough for me.I got it working with
npx vue-cli-service ...Had similar issues as above and this worked
sudo npm cache clean -fThis fixed the issue for me:
Terminal Command:
./node_modules/.bin/vue-cli-service serveIf you use NPM package manager you need move dependencies in package.json from “devDependencies” to “dependencies”. Then NPM on Heroku will install them and vue-cli-service can build your app.
Of course the last comment is the one that holds the answer for me. Resolved by prepending my command with
./node_modules/.bin/Using
npmInstall globally:
npm install -g @vue/cli-service-globalAdd the directory where npm install globals to PATH and make it persistent in a new terminal by adding it to ~/.bashrc:
echo $'\nexport PATH="$(npm -g bin)":$PATH' >> ~/.bashrcnpm cache clean -fworked for me thanks!Hi,
I have exactly the same error for gitlab-ci:
yarn run v1.12.3 $ vue-cli-service build /bin/sh: 1: vue-cli-service: not found info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 127. ERROR: Job failed: exit code 1Hi, I had the same issue for a while.
TL;DR
As the documentation specify it is a development dependency https://cli.vuejs.org/guide/#cli-service
Origin
I had a fresh install of nodejs And just did
The issue
The issue presented like this
The fixes:
Which led me straight to another error message
Which I fixed the same way
And now it is working fine.
same issue here on ubuntu 18.04… i just tried a complete reinstall of nodejs and npm and deleted all global node_modules
Using github actions, the only way that worked for me was to set NODE_ENV to development just for install
My problem was in Netlify build.
By using
YARN_VERSIONset to1.17.0in environment variables of Netlify, the problem fixed.This is the another correct way… Always works for me.
that fixs me: edit
package.json->scripts, changevue-cli-servicetonode_modules/.bin/vue-cli-serviceon ubuntu I fixed this by:
apt-get remove npmcurl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bashnvm install --latest-npmrm -rf node_modules package-lock.json && npm installTried all of the suggestions above and still having this issue with OS X 10.14.2.
vue --versiondisplays 3.3.0.Another solution
If you use
yarn:~/.bashrcfor editing in any text editor on directly in terminal usingnano:THE_OUTPUT_FROM_STEP_2with the text that you copied in step 2 :This will add the
.yarn/bindirectory to$PATHand will make it possible to use every package located in this directory globally.Save with
Ctrl + Sand exitCtrl + XLog out / Log in (or restart the computer)
Done. Now you can call
vueglobally, e.g. to check vue version run:yarn -g binoutput, specify the following path:Don’t forget to replace
YOUR_USER_NAMEwith your usernameIf you use
npm:Do the same thing but:
npm install -g @vue/cliinstead ofyarn global add @vue/clinpm -g bininstead ofyarn -g bin~/.bashrcfile.it’s work for me too
Local build is fine. It is not built on Docker and Travis. What’s wrong?
i can’t understand
Thanks @yoannes - I was missing the npm ci as part of my build.
- run: npm ci && npm run buildworked for me
In my case, the package
@vue/cli-serviceis installed in my local node_modules environment, but not my global environment, so it cannot be used as a command. I type./node_modules/.bin/vue-cli-service serveand it works.npm install -g @vue/cli-service-global
Not sure if this is the correct solution, but deleting node_modules and npm install didn’t solve it for me. It looks like you need to install @vue/cli-service and any plugins you use globally. Here’s my solution: Host: Windows 10
Dockerfile
docker-compose.yml
The
shadow-uivolume prevents the node_modules directory on my host (windows) from being mounted into my container (debian), sonpm ciwill download the correct binaries for node-sass. This error presents itself as “Could not find package vue-template-compiler” or something similar.finally this helped me, thank a lot.
https://github.com/vuejs/vue-cli/issues/2404#issuecomment-454642931
Yeah but then how do you deploy your actual production environment then 😄 ?
I try all of them and now it’s working)
This work for me too…
Similar to @COil’s comment. Simply got this error when cloning new repo and attempting to run
yarn servebeforeyarn/yarn install.in my case I think there was a conflict with yarn and npm.
I did
Which worked for me
thanks
Hi, everyone, I’ve got the same error.
Apparently, I try to build the app locally, and it works fine.
But when I push the code to github, and the arrival of a new commit triggers travis-ci build job, and it gives me the error which is “/bin/sh: 1: vue-cli-service: not found”.
https://github.com/whizjs/superjs/blob/master/.travis.yml
By the way, travis-ci has been working fine util this latest commit.
I don’t know where to start the debug.