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: [email protected] /home/vagrant/npm/lib/node_modules/gulp
==> Vaprobash: ├── [email protected]

[...]

==> Vaprobash: └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
==> Vaprobash:
==> Vaprobash: [email protected] /home/vagrant/npm/lib/node_modules/bower
==> Vaprobash: ├── [email protected]

[...]

==> Vaprobash: └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
==> 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" [email protected]:

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