Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant provision fails with error: "npm: command not found" #547

Closed
zaksoup opened this issue Sep 25, 2015 · 5 comments
Closed

Vagrant provision fails with error: "npm: command not found" #547

zaksoup opened this issue Sep 25, 2015 · 5 comments
Labels

Comments

@zaksoup
Copy link

zaksoup commented Sep 25, 2015

Trying to set up the vagrant dev environment but provisioning is failing with error:

==> Vaprobash: >>> Starting to config Node.js
==> Vaprobash: /tmp/vagrant-shell: line 62: npm: command not found
==> Vaprobash: >>> Start installing Global Node Packages
==> Vaprobash: /tmp/vagrant-shell: line 78: npm: command not found```

This might be an issue only with Vaprobash: https://github.com/fideloper/Vaprobash/blob/master/scripts/nodejs.sh#L59 seems to be the relevant output.

There also seem to be some relevant issues over at Vaprobash:
fideloper/Vaprobash#172
fideloper/Vaprobash#136

@tobyzerner
Copy link
Contributor

Hmm what was the output below ">>> Installing Node Version Manager" and ">>> Installing Node.js version $NODEJS_VERSION"?

@zaksoup
Copy link
Author

zaksoup commented Sep 25, 2015

@tobscure I missed something: the output is slightly different when running vagrant up from a clean slate as opposed to running vagrant provision on a running (but previously failed) vm.

The first time I see this:

==> Vaprobash: Running provisioner: shell...
    Vaprobash: Running: /var/folders/6k/qlkg2mzd5c972bpfm81t1glh0000gp/T/vagrant-shell20150925-45786-hu1f8p.sh
==> Vaprobash: >>> Installing Node Version Manager
==> Vaprobash: Cloning into '/home/vagrant/.nvm'...
==> Vaprobash: >>> Appending source string to /home/vagrant/.profile
==> Vaprobash: >>> Installing Node.js version latest
==> Vaprobash:     This will also be set as the default node version

[this is where curl barfs all over vagrant's output]

==> Vaprobash: Now using node v4.1.1 (npm v2.14.4)
==> Vaprobash: default -> v4.1.1
==> Vaprobash: Now using node v4.1.1 (npm v2.14.4)
==> Vaprobash: >>> Starting to config Node.js
==> Vaprobash: >>> Start installing Global Node Packages
==> Vaprobash: /home/vagrant/npm/bin/gulp -> /home/vagrant/npm/lib/node_modules/gulp/bin/gulp.js
==> Vaprobash: /home/vagrant/npm/bin/bower -> /home/vagrant/npm/lib/node_modules/bower/bin/bower
==> Vaprobash: gulp@3.9.0 /home/vagrant/npm/lib/node_modules/gulp
==> Vaprobash: ├── pretty-hrtime@1.0.0

[...]

==> Vaprobash: └── vinyl-fs@0.3.14 (graceful-fs@3.0.8, strip-bom@1.0.0, defaults@1.0.2, vinyl@0.4.6, mkdirp@0.5.1, through2@0.6.5, glob-stream@3.1.18, glob-watcher@0.0.6)
==> Vaprobash:
==> Vaprobash: bower@1.5.3 /home/vagrant/npm/lib/node_modules/bower
==> Vaprobash: ├── is-root@1.0.0

[...]

==> Vaprobash: └── inquirer@0.8.0 (ansi-regex@1.1.1, figures@1.4.0, mute-stream@0.0.4, through@2.3.8, readline2@0.1.1, lodash@2.4.2, chalk@0.5.1, rx@2.5.3, cli-color@0.3.3)
==> Vaprobash: Running provisioner: shell...
    Vaprobash: Running: /var/folders/6k/qlkg2mzd5c972bpfm81t1glh0000gp/T/vagrant-shell20150925-45786-1ijgcm8.sh
==> Vaprobash: nvm is not compatible with the npm config "prefix" option: currently set to "/home/vagrant/npm"
==> Vaprobash: Run `nvm use --delete-prefix v4.1.1 --silent` to unset it.

After installing ZSH and Phantomjs it finally fails:

==> Vaprobash: mkdir:
==> Vaprobash: cannot create directory ‘/home/vagrant/npm’
==> Vaprobash: : File exists
==> Vaprobash: cp:
==> Vaprobash: cannot stat ‘/vagrant/scripts/aliases’
==> Vaprobash: : No such file or directory
==> Vaprobash: You are not currently on a branch. Please specify which
==> Vaprobash: branch you want to merge with. See git-pull(1) for details.
==> Vaprobash:
==> Vaprobash:     git pull <remote> <branch>
==> Vaprobash: Loading composer repositories with package information
==> Vaprobash: Installing dependencies (including require-dev) from lock file
==> Vaprobash: Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
==> Vaprobash: Nothing to install or update
==> Vaprobash: Generating autoload files
==> Vaprobash: Loading composer repositories with package information
==> Vaprobash: Installing dependencies (including require-dev) from lock file
==> Vaprobash: Nothing to install or update
==> Vaprobash: Generating autoload files
==> Vaprobash: [Studio] Merging subproject autoloaders...
==> Vaprobash: done
==> Vaprobash: Generating autoload files
==> Vaprobash: [Studio] Merging subproject autoloaders...
==> Vaprobash: done
==> Vaprobash: /usr/bin/env:
==> Vaprobash: node
==> Vaprobash: : No such file or directory
==> Vaprobash: /tmp/vagrant-shell: line 88: npm: command not found
==> Vaprobash: /usr/bin/env:
==> Vaprobash: node
==> Vaprobash: : No such file or directory
==> Vaprobash: /tmp/vagrant-shell: line 92: npm: command not found
==> Vaprobash: /usr/bin/env:
==> Vaprobash: node
==> Vaprobash: : No such file or directory
==> Vaprobash: PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class Flarum\Console\GenerateMigrationCommand does not exist' in /vagrant/flarum/vendor/illuminate/container/Container.php:736
==> Vaprobash: Stack trace:
==> Vaprobash: #0 /vagrant/flarum/vendor/illuminate/container/Container.php(736): ReflectionClass->__construct('Flarum\\Console\\...')
==> Vaprobash: #1 /vagrant/flarum/vendor/illuminate/container/Container.php(626): Illuminate\Container\Container->build('Flarum\\Console\\...', Array)
==> Vaprobash: #2 /vagrant/flarum/core/src/Core/Application.php(663): Illuminate\Container\Container->make('Flarum\\Console\\...', Array)
==> Vaprobash: #3 /vagrant/flarum/flarum(26): Flarum\Core\Application->make('Flarum\\Console\\...')
==> Vaprobash: #4 {main}
==> Vaprobash:   thrown in /vagrant/flarum/vendor/illuminate/container/Container.php on line 736

The second run fails much quicker:
It does some apt getting from ubuntu's repos and then

==> Vaprobash: >>> Installing Node Version Manager
==> Vaprobash: >>> NVM is already installed in /home/vagrant/.nvm, trying to update
=>  Vaprobash: -ne
==> Vaprobash: Already up-to-date.
==> Vaprobash: >>> Source string already in /home/vagrant/.profile
==> Vaprobash: nvm is not compatible with the npm config "prefix" option: currently set to "/home/vagrant/npm"
==> Vaprobash: Run `nvm use --delete-prefix v4.1.1 --silent` to unset it.
==> Vaprobash: >>> Installing Node.js version latest
==> Vaprobash:     This will also be set as the default node version

[more curl barf]

==> Vaprobash: v4.1.1 is already installed.
==> Vaprobash: Now using node v4.1.1 (npm v2.14.4)
==> Vaprobash: nvm is not compatible with the npm config "prefix" option: currently set to "/home/vagrant/npm"
==> Vaprobash: Run `nvm use --delete-prefix v4.1.1` to unset it.
==> Vaprobash: default -> v4.1.1
==> Vaprobash: Now using node v4.1.1 (npm v2.14.4)
==> Vaprobash: nvm is not compatible with the npm config "prefix" option: currently set to "/home/vagrant/npm"
==> Vaprobash: Run `nvm use --delete-prefix v4.1.1` to unset it.
==> Vaprobash: >>> Starting to config Node.js
==> Vaprobash: /tmp/vagrant-shell: line 62: npm: command not found
==> Vaprobash: >>> Start installing Global Node Packages
==> Vaprobash: /tmp/vagrant-shell: line 78: npm: command not found

I'm not sure if the nvm issue with prefix is a red herring, but the git errors definitely seem to indicate that one of those issues I linked above isn't entirely fixed.

@franzliedke
Copy link
Contributor

I encountered and fixed this yesterday, but forgot to push it. :(

I will do that on Monday.

@zaksoup
Copy link
Author

zaksoup commented Sep 26, 2015

hey @franzliedke, any chance you could let me know what the fix was so I can apply it locally this weekend? I wanted to play around a bit for fun. If not, no worries 😄

@franzliedke
Copy link
Contributor

The last line in your error log output. - - delete-prefix or something. But
use "stable" rather than the version number.
Am 26.09.2015 19:52 schrieb "Zak Auerbach" notifications@github.com:

hey @franzliedke https://github.com/franzliedke, any chance you could
let me know what the fix was so I can apply it locally this weekend? I
wanted to play around a bit for fun. If not, no worries [image: 😄]


Reply to this email directly or view it on GitHub
#547 (comment).

smile1130 added a commit to smile1130/laravel-simple-forum that referenced this issue Jun 16, 2023
helixdonnell9 added a commit to helixdonnell9/flarum that referenced this issue Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants