3.0.1
nvm 0.33.1 / Node v8.11.4 / Ubuntu 16.04
npm run build fails because vue-cli-service: command not found
npm run build succeeds
npm run build fails because vue-cli-service: command not found
Installed globally with npm install -g @vue/cli@latest
Please provide a valid reproduction when opening an issue.
@sodatea please explain how it would be possible to provide a reproduction for this issue.
Like, the project repository created by vue create
.
Okay, here is a repository that I created with vue create
:
https://asciinema.org/a/spTomiYQM8FPUuPhpPucA9S9r
Cannot reproduce on macOS.
Have you tried rm -rf node_modules
and npm install
again?
This works fine on my macOS. The issue is on Ubuntu 16.04 with nvm.
Yes, I have tried rm -rf node_modules
and reinstall.
Still can't reproduce with a fresh install of nvm
& node
.
https://asciinema.org/a/hRDyrM5HcDHVieV3mPLEVlhdL
Maybe the $PATH
variable is somehow messed up in your environment.
Please let me know what executables the $PATH should include.
Have you tested in Ubuntu 16.04?
On Thu, 30 Aug 2018 at 11:47 PM Haoqun Jiang notifications@github.com
wrote:
Still can't reproduce with a fresh install of nvm & node.
https://asciinema.org/a/hRDyrM5HcDHVieV3mPLEVlhdLMaybe the $PATH variable is somehow messed up in your environment.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/vuejs/vue-cli/issues/2404#issuecomment-417346214, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AK5OkJWsFS1XqKD0gNGEUWqFB9OnB00Mks5uV_r1gaJpZM4WThwJ
.
Yes, I've posted the terminal session recorded in Ubuntu 16.04 above.
I don't know if this helps but here's my $PATH:
/home/soda/.nvm/versions/node/v8.11.4/bin:/home/soda/bin:/home/soda/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
This is most likely an npm
issue (for not prepending ./node_modules/.bin
to $PATH
). So please also try updating npm
version.
Also, try to call it by npx:
npx vue-cli-service build
Closing due to inactivity for more than 1 week. Please open a new issue with a reference to this one if you can follow up with more information.
I 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 bin
is a folder where vue (vue cli 3) was placed
This was a suggestion from a yarn issue
Yeah, don't close this issue please. I'm getting this as well. vue-cli-service: not found
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.
same issue here on ubuntu 18.04.. i just tried a complete reinstall of nodejs and npm and deleted all global node_modules
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 1
Had similar issues as above and this worked
sudo npm cache clean -f
rm -rf node_modules package-lock.json && npm install
worked for me
Tried all the options above nothing worked for me
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.
Of course the last comment is the one that holds the answer for me. Resolved by prepending my command with ./node_modules/.bin/
I think @PeterA1 could be right.
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.
Tried all of the suggestions above and still having this issue with OS X 10.14.2. vue --version
displays 3.3.0.
npm cache clean -f
worked for me thanks!
I had the same problem when building on Bitbucket Pipelines. The solution was, similar to above, to go to pipelines, select Caches, mouseover the node_modules dependency cache and click the trashcan icon.
on ubuntu I fixed this by:
1) uninstalled my old npm that was installed using apt install
apt-get remove npm
2) installed nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash
3) restarted terminal
4) installed latest npm using nvm
nvm install --latest-npm
5) reinstall packages as suggested by diachedelic
rm -rf node_modules package-lock.json && npm install
I got it working with npx vue-cli-service ...
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
FROM node:8.10-stretch
# update npm & install vue cli peer dependencies
RUN npm install -g npm
RUN npm install -g @vue/cli @vue/cli-service @vue/cli-plugin-babel @vue/cli-plugin-eslint
WORKDIR /app
COPY package*.json ./
RUN npm ci
VOLUME /app
CMD npm run serve
docker-compose.yml
version: "3.5"
services:
ui:
build:
context: ui/
ports:
- 3000:80
volumes:
- ./ui/:/app
- shadow-ui:/app/node_modules:delegated # see comment below
stdin_open: true
tty: true
environment:
CHOKIDAR_USEPOLLING: 'true'
volumes:
shadow-ui: # see comment below
The shadow-ui
volume prevents the node_modules directory on my host (windows) from being mounted into my container (debian), so npm ci
will download the correct binaries for node-sass. This error presents itself as "Could not find package vue-template-compiler" or something similar.
if happened while building docker image, try to remove NODE_ENV=production
before npm install
or yarn install
.
sudo yarn install fixed mine thanks @hyuckgi
I think this issue needs to be re-opened because I have got this error simply by deleting my node_modules and re-running npm install from inside the root directory of the application. Running $ vue create project-name allows for npm run serve to work correctly.
that fixs me:
edit package.json
-> scripts
, change vue-cli-service
to node_modules/.bin/vue-cli-service
I also get it, will check if @microJ 's solution fixes it.
See...
Of course the last comment is the one that holds the answer for me. Resolved by prepending my command with
./node_modules/.bin/
This issue seems to be caused by several user environment related issues (unrelated to vue-cli):
node_modules
, which can be caused by bad installation of the project packages ➡️ delete node_module
and reinstall (deleting package-lock.json
or yarn.lock
too before reinstalling can also help):
in the path, for example /Users/julien/programming:work/path/to/my-app
(PATH
separator is the :
character)https://stackoverflow.com/questions/40546231/sh-react-scripts-command-not-found-after-running-npm-start
https://stackoverflow.com/questions/47612580/react-scripts-command-not-found?rq=1
https://github.com/facebook/create-react-app/issues/3256#issuecomment-340259809
https://github.com/facebook/create-react-app/issues/3256#issuecomment-358406611
https://stackoverflow.com/questions/47842849/how-to-resolve-sh-react-scripts-command-not-found
https://npm.community/t/npm-script-cant-find-module-without-the-full-path/1344/15
rm -rf node_modules package-lock.json && npm install
worked for me
this works for me
rm -rf node_modules package-lock.json && npm install
为我工作
thanks
I did npm install
and that was enough for me.
Works if you run the "npm install" in "cmd", but not in powershell.
I'm using ubuntu inside windows 10.
In my case the problem WAS the Malwarebytes :( it was blocking some update in my npm install!
I got the same error in WSL ubuntu on Win 10.
My solution was to call ./node_modules/.bin/vue-cli-service
; i.e. ./node_modules/.bin/vue-cli-service build --mode development
.
Hey!
This is the correct solution: you need to install @vue/cli-service
module.
Using NPM
$ npm i -S @vue/cli-service
Using Yarn
$ yarn add @vue/cli-service
Hey!
This is the correct solution: you need to install@vue/cli-service
module.
Using NPM$ npm i -S @vue/cli-service
Using Yarn
$ yarn add @vue/cli-service
Its Worked for me.
Hey!
This is the correct solution: you need to install@vue/cli-service
module.
Using NPM$ npm i -S @vue/cli-service
Using Yarn
$ yarn add @vue/cli-service
Its Worked for me.
If it doesent work, do this again, and call it like this./node_modules/.bin/vue-cli-service
The only thing that worked for me was going to plugins menu at Vue UI interface and download '@vue/cli-service' from there
If 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.
npm install -g @vue/cli-service-global
npm install -g @vue/cli-service-global
This is the another correct way... Always works for me.
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.
That resolved it for me, thanks!
Using npm
Install globally:
npm install -g @vue/cli-service-global
Add 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' >> ~/.bashrc
in my case I think there was a conflict with yarn and npm.
I did
Which worked for me
I also was getting same issue: I resolved it by cleaning cache of npm npm cache clean -f and removing package-lock.json file rm -rf node-modules package-lock.json and start fresh install.
Got the same issue when deploy vue project in jenkins.
Here is what I did:
Add node's bin/
dir, to jenkins user's .bashrc
file.
e.g
# node
NODE_HOME=/home/dev/.nvm/versions/node/default
PATH=$NODE_HOME/bin:$PATH
The issue still exists. Running everything as Docs say, does not work.
Local build is fine.
It is not built on Docker and Travis.
What's wrong?
# base image
FROM node:11.12.0-alpine as builder
ENV PATH ./node_modules/.bin:$PATH
RUN apk update && apk --no-cache --virtual build-dependencies add python make g++ \
&& npm install \
&& apk del build-dependencies
RUN npm run build
sh: vue-cli-service: not found
{
"private": true,
"scripts": {
"serve": "./node_modules/.bin/vue-cli-service serve --modern",
"build": "./node_modules/.bin/vue-cli-service build --modern"
},
"dependencies": {
"@mdi/font": "^4.7.95",
"core-js": "^3.4.4",
"vue": "^2.6.10",
"vue-i18n": "^8.0.0",
"vue-router": "^3.1.3",
"vuejs-logger": "^1.5.3",
"vuetify": "^2.1.0",
"vuex": "^3.1.2"
},
"devDependencies": {
"@kazupon/vue-i18n-loader": "^0.3.0",
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-unit-jest": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/test-utils": "1.0.0-beta.29",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"jest-coverage-badges": "^1.1.2",
"node-sass": "^4.12.0",
"prerender-spa-plugin": "^3.4.0",
"robotstxt-webpack-plugin": "^7.0.0",
"sass": "^1.19.0",
"sass-loader": "^8.0.0",
"standard-version": "^7.0.1",
"vue-cli-plugin-vuetify": "^2.0.3",
"vue-template-compiler": "^2.6.10",
"vuetify-loader": "^1.3.0"
}
}
i can't understand
My problem was in Netlify build.
By using YARN_VERSION
set to 1.17.0
in environment variables of Netlify, the problem fixed.
getting the same one too for a project that i forked
What works was running npm install
before building it. I thought that vue cli installed globally would have been enough
In my case, the package @vue/cli-service
is 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 serve
and it works.
In my case, I simply forgot to run yarn install
before running the build script yarn build
.
If 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.
A 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
"heroku-prebuild": "npm install -g @vue/cli-service",
You can also customize the heroku-postbuild
if you need additional configuration.
Similar to @COil's comment. Simply got this error when cloning new repo and attempting to run yarn serve
before yarn
/yarn install
.
My solution on Ubuntu 20.04:
npm i -g @vue/cli
rm -rf node_modules package-lock.json && npm install
My solution on Ubuntu 20.04:
npm i -g @vue/cli
rm -rf node_modules package-lock.json && npm install
This work for me too.....
Hey!
This is the correct solution: you need to install@vue/cli-service
module.
Using NPM$ npm i -S @vue/cli-service
Using Yarn
$ yarn add @vue/cli-service
it's work for me too
I try all of them and now it's working)
rm -rf node_modules package-lock.json && npm install
worked for me
This worked for me!
rm -rf node_modules package-lock.json && npm install
worked for me
This worked for me!
If 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.
A 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"heroku-prebuild": "npm install -g @vue/cli-service",
You can also customize the
heroku-postbuild
if you need additional configuration.
First I update the npm to the lasted version, then I run it, This works for me!
rm -rf node_modules package-lock.json && npm install
worked for me
This worked for me too. Ubuntu 18.04
Ubuntu 20.04
Still an issue for me...
sudo npm install -g @vue/cli
...
$ vue
command "vue" not found
Something apparently gets installed here:
/usr/local/lib/node_modules/@vue/cli/bin
Ok, I created a link to resolve this issue (not sure why something like isn't handled on install...
```
sudo ln -s /usr/local/lib/node_modules/@vue/cli/bin/vue.js /usr/local/bin/vue
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.
https://github.com/vuejs/vue-cli/issues/2404#issuecomment-454642931
Yeah but then how do you deploy your actual production environment then :D ?
yarn
:yarn global add @vue/cli
yarn -g bin
// Output: /home/YOUR_USER_NAME/.yarn/bin
~/.bashrc
for editing in any text editor on directly in terminal using nano
:sudo nano ~/.bashrc
THE_OUTPUT_FROM_STEP_2
with the text that you copied in step 2 :export PATH=$PATH:THE_OUTPUT_FROM_STEP_2
This will add the .yarn/bin
directory to $PATH
and will make it possible to use every package located in this directory globally.
Save with Ctrl + S
and exit Ctrl + X
Log out / Log in (or restart the computer)
Done. Now you can call vue
globally, e.g. to check vue version run:
vue --version
If it still cannot find vue, go back to step 3 and in step 4, instead of the yarn -g bin
output, specify the following path:
export PATH=$PATH:/home/YOUR_USER_NAME/.yarn/bin
Don't forget to replace YOUR_USER_NAME
with your username
npm
:Do the same thing but:
npm install -g @vue/cli
instead of yarn global add @vue/cli
npm -g bin
instead of yarn -g bin
~/.bashrc
file.I don't use Linux as my primary OS, so I don't know if it's a good idea to add path variables to
~/.bashrc
file.
for me it has to be in .bashrc
vs .bash_profile
for reason i cant remember.
Hi, I had the same issue for a while.
npm install @vue/cli-service --save-dev
As the documentation specify it is a development dependency https://cli.vuejs.org/guide/#cli-service
The CLI Service (@vue/cli-service) is a development dependency. It's an npm package installed locally into every project created by @vue/cli.
I had a fresh install of nodejs
And just did
>> sudo npm install -g @vue/cli@latest
>> vue --version
@vue/cli 4.5.8
The issue presented like this
>> npm run serve
yarn run v1.22.10
$ vue-cli-service build --mode development --watch
/bin/sh: 1: vue-cli-service: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm install @vue/cli-service --save-dev
Which led me straight to another error message
>> npm run serve
yarn run v1.22.10
$ vue-cli-service build --mode development --watch
ERROR Error: Cannot find module 'vue-template-compiler/package.json'
Which I fixed the same way
npm i vue-template-compiler --save-dev
And now it is working fine.
Most helpful comment
rm -rf node_modules package-lock.json && npm install
worked for me