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

Does not install on Ubuntu 16.04. #246

Closed
frozenfoxx opened this issue Sep 26, 2016 · 16 comments
Closed

Does not install on Ubuntu 16.04. #246

frozenfoxx opened this issue Sep 26, 2016 · 16 comments
Labels
bug Something isn't working needs-feedback Further information is requested

Comments

@frozenfoxx
Copy link
Contributor

frozenfoxx commented Sep 26, 2016

This module on Ubuntu 16.04 installs seems to only remove npm by default, not install it. This does not seem to be expected behavior since https://github.com/voxpupuli/puppet-nodejs/blob/master/manifests/params.pp#L69-L78 seems to indicate it should install by default.

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.7.0
  • Ruby: 2.1.9p490
  • Distribution: Ubuntu 16.04
  • Module version: 2.0.1

How to reproduce (e.g Puppet code you use)

https://github.com/frozenfoxx/puppet-hubot/blob/master/manifests/init.pp#L152-L157 on a Ubuntu 16.04 Puppet 4 system.

What are you seeing

Module ensures npm is absent, removing the package if it was installed previously.

What behaviour did you expect instead

Install the npm package.

Output log

Notice: /Stage[main]/Nodejs::Install/Package[nodejs-dev]/ensure: removed
Notice: /Stage[main]/Nodejs::Install/Package[npm]/ensure: removed
Error: Could not update: Command npm is missing
Error: /Stage[main]/Hubot::Install/Package[hubot]/ensure: change from absent to 2.16.0 failed: Could not update: Command npm is missing

Any additional information you'd like to impart

In further testing it looks like the GitHub code may be just fine, but the Forge version does not match the latest commits here.

@juniorsysadmin
Copy link
Member

Fixed by #242 , needs release

@juniorsysadmin juniorsysadmin added the bug Something isn't working label Sep 27, 2016
@cliff-wakefield
Copy link

Still suffering the same issue even though I am using the latest commit, has this really been resolved?

@juniorsysadmin juniorsysadmin reopened this Oct 6, 2016
@cliff-wakefield
Copy link

Seems if I just let it install the latest from the default repos then it does work.

However if I specify repo_url_suffix => '6.x', it doesn't.

@terrarum
Copy link

I am having the exact same problem as @cliff-wakefield. Using puppet-nodejs 2.1.0, Ubuntu 16.04, Puppet 3.8.5.

@mxcoder
Copy link
Contributor

mxcoder commented Nov 23, 2016

Try this:

class { 'nodejs' :
  repo_url_suffix => '6.x',
  nodejs_dev_package_ensure => 'absent',
  npm_package_ensure => 'absent',
}

The problem seems to be:
https://github.com/voxpupuli/puppet-nodejs/blob/master/manifests/params.pp#L80
https://github.com/voxpupuli/puppet-nodejs/blob/master/manifests/params.pp#L82

Because for xenial: https://deb.nodesource.com/node_6.x/dists/xenial/main/binary-amd64/Packages

Package: nodejs
Version: 6.9.1-1nodesource1~xenial1
Architecture: amd64
Maintainer: Chris Lea <[email protected]>
Installed-Size: 49558
Depends: libc6 (>= 2.15), libgcc1 (>= 1:3.4), libstdc++6 (>= 5.2)
Conflicts: nodejs-dev, nodejs-legacy, npm
Replaces: nodejs-dev (<= 0.8.22), nodejs-legacy, npm (<= 1.2.14)
Provides: nodejs-dev, nodejs-legacy, npm

PR Here: #261

@frozenfoxx
Copy link
Contributor Author

frozenfoxx commented Dec 10, 2016

After PR #261 this has broken for me again. On my 16.04 system now I am experiencing the same behavior as before, npm is getting removed automatically which makes it impossible to keep nodejs and npm installed.

Forcing those values back to present in hiera resolves the issue:

nodejs::nodejs_dev_package_ensure:   'present'
nodejs::npm_package_ensure:          'present'
nodejs::repo_url_suffix:             '0.12'

If the above PR fixes it for node 6 that's great but this is going to need different behavior for older node versions still in the wild (notably 0.12 in this case).

@mxcoder
Copy link
Contributor

mxcoder commented Dec 10, 2016

Hey @frozenfoxx sorry to hear about the issue, in theory using that suffix you're requesting this:

https://deb.nodesource.com/node_0.12/dists/xenial/main/binary-amd64/Packages
or
https://deb.nodesource.com/node_0.12/dists/xenial/main/binary-i386/Packages
(might want to view source, content-type is off)

And those also show:

Package: nodejs
Version: 0.12.17-1nodesource1~xenial1
Architecture: amd64
Maintainer: Jérémy Lal <[email protected]>
Installed-Size: 34412
Depends: libc6 (>= 2.15), libgcc1 (>= 1:3.4), libstdc++6 (>= 5.2), rlwrap
Conflicts: nodejs-dev, nodejs-legacy, npm
Replaces: nodejs-dev (<= 0.8.22), nodejs-legacy, npm (<= 1.2.14)
Provides: nodejs-dev, nodejs-legacy, npm

As you can see this repo provides a nodejs package that also provides nodejs-dev, nodejs-legacy, npm hence no need to force (using present) npm and nodejs-dev.

Not sure how else we can debug this, but maybe its some repo-level cache on your end? Or can you provide some debugging data? I think its important we correct this.

@juniorsysadmin juniorsysadmin added the needs-feedback Further information is requested label Dec 25, 2016
@frozenfoxx
Copy link
Contributor Author

I'm still running into this issue. To test it I've been using Docker Ubuntu 16.04 containers, just telling it to install npm. By the nature of the Docker container that's a fresh environment every time.

@zdavis
Copy link

zdavis commented Sep 17, 2017

There does indeed seem to be an issue installing nodejs on ubuntu 16.04. Using this declaration:

  class { 'nodejs':
    repo_url_suffix => '6.x',
    nodejs_dev_package_ensure => 'absent',
    npm_package_ensure => 'absent'
  }

..on a fresh ubuntu 16.04 VM, I end up with circular symlinks:

/usr/bin/node > /usr/bin/nodejs
/usr/bin/nodejs > /etc/alternatives/nodejs
/etc/alternatives/nodejs > /usr/bin/node

If I then apt-get remove nodejs I get an error from apt-get caused by the unresolvable symlinks. If I then manually remove the symlinks, remove nodejs with apt-get, and then reinstall it from the nodesource repo, it installs correctly and works as expected. It seems there's something that this module is doing around creating those symlinks that's causing the problem.

@zdavis
Copy link

zdavis commented Sep 17, 2017

Looks like it's caused by this:

https://github.com/voxpupuli/puppet-nodejs/blob/master/manifests/install.pp#L44

Node 6.x on Ubuntu 16 installs the actually node executable at /usr/bin/node and /usr/bin/nodejs is symlinked to /etc/alternatives/nodejs. The referenced line, above, symlinks /etc/alternatives/nodejs to /usr/bin/node, which creates the circular links.

If you're stuck on this, there is a workaround. Setting the legacy_debian_symlinks flag to false will prevent this module from making that symlink. This works for me:

  class { 'nodejs':
    repo_url_suffix => '6.x',
    legacy_debian_symlinks => false,
    nodejs_dev_package_ensure => 'absent',
    npm_package_ensure => 'absent'
  }

@zdavis
Copy link

zdavis commented Sep 17, 2017

...same problem is identified and solved in #317

@bastelfreak
Copy link
Member

Hi @zdavis, I merged the PR #317, could you verify with our master branch if your errors are resolved?

@wyardley
Copy link
Contributor

Will #317 cause problems if package source is something other than the distribution ones (e.g., nodesource)? What if a user already has the older package installed and hasn't upgraded yet?

@wyardley
Copy link
Contributor

Noticed this when investigating this a little more:
To run 'node' please ask your administrator to install the package 'nodejs-legacy'
I think the right fix is to install nodejs-legacy package in certain-conditions (based on package source and / or os / nodejs version)

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

root@ubuntu-server-1604-x64:~# apt-get install nodejs-legacy
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  nodejs-legacy
0 upgraded, 1 newly installed, 0 to remove and 188 not upgraded.
Need to get 27.7 kB of archives.
After this operation, 81.9 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 nodejs-legacy all 4.2.6~dfsg-1ubuntu4.1 [27.7 kB]
Fetched 27.7 kB in 0s (62.1 kB/s)  
Selecting previously unselected package nodejs-legacy.
(Reading database ... 69869 files and directories currently installed.)
Preparing to unpack .../nodejs-legacy_4.2.6~dfsg-1ubuntu4.1_all.deb ...
Unpacking nodejs-legacy (4.2.6~dfsg-1ubuntu4.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nodejs-legacy (4.2.6~dfsg-1ubuntu4.1) ...
root@ubuntu-server-1604-x64:~# node
> root@ubuntu-server-1604-x64:~# node --version
v4.2.6
root@ubuntu-server-1604-x64:~# file /usr/bin/node
/usr/bin/node: symbolic link to nodejs
root@ubuntu-server-1604-x64:~# ls -al /usr/bin/node
lrwxrwxrwx 1 root root 6 May 20  2016 /usr/bin/node -> nodejs

I think this is probably cleaner, and also easier to work into some kind of logic for the module. Though it sounds like with the official packages, it's just a symlink too, so maybe not too harmful? But will the module break things if someone installs a very old node version that installs node as /usr/bin/node?

@wyardley
Copy link
Contributor

Since 'force' defaults to false (and isn't set), I guess it shouldn't cause a huge issue if a real /usr/bin/node gets installed.

@juniorsysadmin
Copy link
Member

Can/Should this issue be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-feedback Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants