Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Trying to install nodejs 4.x or 5.x results in error #417

Closed
kevinquillen opened this issue Feb 5, 2016 · 9 comments
Closed

Trying to install nodejs 4.x or 5.x results in error #417

kevinquillen opened this issue Feb 5, 2016 · 9 comments

Comments

@kevinquillen
Copy link

TASK: [geerlingguy.nodejs | Ensure Node.js and npm are installed.] ************ 
failed: [local.sandbox] => {"failed": true}
msg: Could not fetch updated apt files

I have tried using:

  • 5.5.0
  • 5.x
  • 4.2.6
  • 4.x

When I ssh into the machine and do node --version, it reports 0.12.9.

How can I get the latest stable version running inside of the VM?

@geerlingguy
Copy link
Owner

The geerlingguy.nodejs role uses the Nodesource binary sources, so you should be able to set 4.x, 5.x, 0.12, or 0.10 without issue. However it only installs once, and after that if you want to change versions inside the VM, you can either do so manually by installing nvm and switching on the fly, or you have to reset things by hand.

Is this on a fresh VM provision, or are you reprovisioning an existing VM that was built with 0.12?

@kevinquillen
Copy link
Author

SSHing in and removing it, then specifying the version as 4.3.0 worked. Rpeating that and trying 5.6.0 did not work.

If I removed it, then did sudo apt-get install in the VM instead of the config.yml, 5.6.0 installs successfully.

I also noticed that on provisioning, npm isn't always installed... and I get this error:

TASK: [geerlingguy.nodejs | Add NodeSource repositories for Node.js.] ********* 
ok: [local.d8contrib] => (item=deb https://deb.nodesource.com/node_4.x trusty main)
ok: [local.d8contrib] => (item=deb-src https://deb.nodesource.com/node_4.x trusty main)

TASK: [geerlingguy.nodejs | Ensure Node.js and npm are installed.] ************ 
failed: [local.d8contrib] => {"failed": true}
msg: Could not fetch updated apt files

When I SSH into the VM, it reported npm as not being installed... and then reported node as not being installed, even though previously it had installed it.

Is there something funky in the nodejs role? My success rate on getting it installed is low, whereas from command line the VM will get and install NodeJS 5.6.0 without an issue.

@geerlingguy
Copy link
Owner

See also: geerlingguy/ansible-role-nodejs#16

@kevinquillen
Copy link
Author

Whats the solution here? Is this an upstream issue? I get the task failed on every run now.

@frob
Copy link
Contributor

frob commented Feb 17, 2016

There might be an upstream task, but for here we need to at least document it better.

@geerlingguy
Copy link
Owner

The advanced options for Node.js are documented in that role (https://github.com/geerlingguy/ansible-role-nodejs#role-variables); since a very large number of Drupal projects don't touch/require Node.js at all, I'm a bit hesitant to blanket add documentation for Node.js-specific things unless it's absolutely necessary/relevant.

Similar situation with Ruby... especially with Node seemingly sucking the wind out of Ruby's sails for FE stuff, I don't want to maintain a bunch of crufty documentation on specific Node.js things.

The default could maybe be updated to 0.12 or something like that... but there are a ton of FE toolkits that break in 0.12. Or they break in 4.x. Or they break in 5.x. Or they break in 4.x but work in 0.12 or 5.x.

Basically what I'm saying is that I will work to make the upstream role work correctly with different Node.js versions... but I don't want to maintain changing-and-breaking-every-nanosecond Node.js-specific documentation.

frob added a commit to frob/drupal-vm that referenced this issue Feb 17, 2016
Added version numbers to the nodejs version description. To stem confusion from geerlingguy#417
@frob
Copy link
Contributor

frob commented Feb 17, 2016

I have submitted a pull request that might work for documentation in the example config.

@geerlingguy
Copy link
Owner

I merged the upstream fix, and also merged the updated example.config.yml from @frob, so next step is to get the Node.js role tests working again, tag a new release, then have everyone here test it :)

@geerlingguy
Copy link
Owner

Looks like there's an upstream bug that's causing global package installations to fail if using state=latest, and it looks like it's only affecting Ansible 2.x :/

See: ansible/ansible-modules-extras#1375

Otherwise, the actual versions should work with the latest version of the Node.js role; I'll tag a release to fix this particular issue now, and then hopefully the Ansible npm module issue will get resolved soon as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants