Problem with vue app deployment vue-cli-service not found

Hello, this is my first time using Netlify and I wanted to start by deploying Vuejs app. But I got this problem.

 $ vue-cli-service build
 /bin/sh: 1: vue-cli-service: not found
 error Command failed with exit code 127.

also, I am using yarn and I even tried replacing

 yarn build

with

 yarn global add @vue/cli && yarn build

How do I solve this?

I can only presume that $PATH hasn’t been set up; you may wish to take a look at your environment variables.

Hopefully, this link can give you some useful pointers!

2 Likes

Thank you for your response I think I have all the necessary PATH variables set
Here is the full log.

8:40:19 PM: Build ready to start
8:40:21 PM: build-image version: 9cade8af58c2cf3a17a1e9433d2e979149488837
8:40:21 PM: build-image tag: v3.3.5
8:40:21 PM: buildbot version: 036f37945d6de439a17a554b3ae02e2f8f0f1fb0
8:40:21 PM: Fetching cached dependencies
8:40:21 PM: Starting to download cache of 254.9KB
8:40:21 PM: Finished downloading cache in 101.439921ms
8:40:21 PM: Starting to extract cache
8:40:21 PM: Failed to fetch cache, continuing with build
8:40:21 PM: Starting to prepare the repo for build
8:40:21 PM: No cached dependencies found. Cloning fresh repo
8:40:21 PM: git clone https://github.com/yathomasi/vue-opennotes
8:40:22 PM: Preparing Git Reference refs/heads/master
8:40:23 PM: Starting build script
8:40:23 PM: Installing dependencies
8:40:24 PM: Downloading and installing node v10.18.1...
8:40:25 PM: Downloading https://nodejs.org/dist/v10.18.1/node-v10.18.1-linux-x64.tar.xz...
8:40:25 PM: 
########################################
8:40:25 PM: #####                             63.3%
8:40:25 PM: 
######################################
8:40:25 PM: ################################## 100.0%
8:40:25 PM: Computing checksum with sha256sum
8:40:25 PM: Checksums matched!
8:40:28 PM: Now using node v10.18.1 (npm v6.13.4)
8:40:28 PM: Attempting ruby version 2.6.2, read from environment
8:40:29 PM: Using ruby version 2.6.2
8:40:30 PM: Using PHP version 5.6
8:40:30 PM: Started restoring cached node modules
8:40:30 PM: Finished restoring cached node modules
8:40:30 PM: Started restoring cached yarn cache
8:40:30 PM: Finished restoring cached yarn cache
8:40:30 PM: Installing yarn at version 1.21.1
8:40:30 PM: Installing Yarn!
8:40:30 PM: > Downloading tarball...
8:40:30 PM: [1/2]: https://yarnpkg.com/downloads/1
8:40:30 PM: .21.1/yarn-v1.21.1.tar.gz --> /tmp/yarn.tar.gz.evy39xssSw
8:40:30 PM:   % Total    % Rec
8:40:30 PM: eived % Xferd  Average Speed   Time    Time     Time  Current
8:40:30 PM:                                Dloa
8:40:30 PM: d  Upload   Total   Spent    Left
8:40:30 PM:  Speed
8:40:30 PM: 
  0     0    0     0    0     0
8:40:30 PM: 0      0 --:--:-- --:--:-- --:--:--     0
8:40:30 PM: 
100    79  100    79    0     0    227      0 --:--:-- --:--:-- --:--:--   227
8:40:31 PM: 
  0    93    0     0    0     0      0      0 --:
8:40:31 PM: --:-- --:--:-- --:--:--     0
100    93  100    93    0     0    134      0 --:--:-- --:--:-- --:--:-- 93000
8:40:31 PM: 
100   609    0   609    0
8:40:31 PM:    0    551      0 --:--:--  0:00:01 --:--:--   551
8:40:31 PM: 
100 1215k  100 1215k    0     0   791k      0
8:40:31 PM:   0:00:01  0:00:01 --:--:--  791k
8:40:31 PM: [2/2]: https://yarnpkg.com/dow
8:40:31 PM: nloads/1.21.1/yarn-v1.21.1.tar.gz.asc --> /tmp/yarn.tar.gz.evy39xssSw.asc
8:40:31 PM: 
100    83  100    83    0     0   3030      0 --
8:40:31 PM: :--:-- --:--:-- --:--:--  3030
8:40:31 PM: 
100    97  100    97    0     0   1728      0
8:40:31 PM: --:--:-- --:--:-- --:--:--  1728
8:40:32 PM: 
  0     0    0     0    0     0      0      0
8:40:32 PM:  --:--:-- --:--:-- --:--:--     0
100   613    0   613    0     0   3
8:40:32 PM: 097      0 --:--:-- --:--:-- --:--:--  598k
8:40:32 PM: 
100   832  100   832    0     0   3534      0 --:--:-
8:40:32 PM: - --:--:-- --:--:--  3534
8:40:32 PM: > Verifying integrity...
8:40:32 PM: gpg: Signature made Wed 11 Dec 2019 08:59:13 AM UTC using RSA key ID 69475BAA
8:40:32 PM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>"
8:40:32 PM: gpg: WARNING: This key is not certified with a trusted signature!
8:40:32 PM: gpg:          There is no indication that the signature belongs to the owner.
8:40:32 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
8:40:32 PM:      Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
8:40:32 PM: > GPG signature looks good
8:40:32 PM: > Extracting to ~/.yarn...
8:40:32 PM: > Adding to $PATH...
8:40:32 PM: > Successfully installed Yarn 1.21.1! Please open another terminal where the `yarn` command will now be available.
8:40:33 PM: Installing NPM modules using Yarn version 1.21.1
8:40:34 PM: yarn install v1.21.1
8:40:34 PM: [1/4] Resolving packages...
8:40:34 PM: [2/4] Fetching packages...
8:40:42 PM: warning sha.js@2.4.11: Invalid bin entry for "sha.js" (in "sha.js").
8:40:51 PM: info fsevents@1.2.11: The platform "linux" is incompatible with this module.
8:40:51 PM: info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
8:40:51 PM: info fsevents@2.1.2: The platform "linux" is incompatible with this module.
8:40:51 PM: info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
8:40:51 PM: [3/4] Linking dependencies...
8:40:51 PM: warning " > sass-loader@8.0.0" has unmet peer dependency "webpack@^4.36.0".
8:40:51 PM: warning " > vuetify-loader@1.4.3" has unmet peer dependency "webpack@^4.0.0".
8:40:52 PM: [4/4] Building fresh packages...
8:40:53 PM: Done in 19.15s.
8:40:53 PM: NPM modules installed using Yarn
8:40:53 PM: Started restoring cached go cache
8:40:53 PM: Finished restoring cached go cache
8:40:53 PM: unset GOOS;
8:40:53 PM: unset GOARCH;
8:40:53 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
8:40:53 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
8:40:53 PM: go version >&2;
8:40:53 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
8:40:53 PM: go version go1.12 linux/amd64
8:40:53 PM: Installing missing commands
8:40:53 PM: Verify run directory
8:40:53 PM: Executing user command: yarn build
8:40:53 PM: yarn run v1.21.1
8:40:53 PM: $ vue-cli-service build
8:40:53 PM: /bin/sh: 1: vue-cli-service: not found
8:40:53 PM: error Command failed with exit code 127.
8:40:53 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
8:40:54 PM: Skipping functions preparation step: no functions directory set
8:40:54 PM: Caching artifacts
8:40:54 PM: Started saving node modules
8:40:54 PM: Finished saving node modules
8:40:54 PM: Started saving yarn cache
8:40:54 PM: Finished saving yarn cache
8:40:54 PM: Started saving pip cache
8:40:54 PM: Finished saving pip cache
8:40:54 PM: Started saving emacs cask dependencies
8:40:54 PM: Finished saving emacs cask dependencies
8:40:54 PM: Started saving maven dependencies
8:40:54 PM: Finished saving maven dependencies
8:40:54 PM: Started saving boot dependencies
8:40:54 PM: Finished saving boot dependencies
8:40:54 PM: Started saving go dependencies
8:40:54 PM: Finished saving go dependencies
8:40:56 PM: Error running command: Build script returned non-zero exit code: 127
8:40:56 PM: Failing build: Failed to build site
8:40:57 PM: failed during stage 'building site': Build script returned non-zero exit code: 127
8:40:57 PM: Finished processing build request in 35.869507073s

Hey, cheers for the log. It looks like you might have been caught by some of the build gotchas!

Little did I know Netlify does something special when you add a process.env.NODE_ENV build environment variable.
If you manually set the NODE_ENV to production, any devDependencies in your package.json will NOT be installed when we automatically run yarn install or npm install at the beginning of the build.
So basically since none of my devDependencies were even getting installed, therefore the build failing should be no surprise.

Let me know how you get on :grin:

1 Like

Thank you @Scott
I removed the manually set NODE_ENV to production from variables.
And the site is live opennotes.
Also had to deal with history mode issue adding _redirect on public folder.
Thanks again.

1 Like

Happy I could help, mate! Have a good weekend.

We’re having the same issue on a branch deploy but we don’t have a NODE_ENV env var set. We’ve also tried setting the NODE_ENV to development but for some reason it seems @vue/cli isn’t installed from devDependencies (or possibly some other reason!)

Clearing the cache and retrying has no effect either. Anybody have any suggestions?

Interestingly, it looks from the log like it is installed but it’s still not found which would imply there’s a problem with the path - can someone help me work out how to fix that or is this an issue with the Netlify build process?

Ok - in case anyone else has the same problem, the issue was that the devDependency referenced @vue/cli which is supposed to be used as a globally installed dependency. When using a devDependency you need to use @vue/cli-service

2 Likes

thanks for sharing your solution!

1 Like