Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

NPM executables not symlinked #94

Closed
Dimitar-Boychev opened this issue Apr 15, 2015 · 11 comments · Fixed by #153
Closed

NPM executables not symlinked #94

Dimitar-Boychev opened this issue Apr 15, 2015 · 11 comments · Fixed by #153
Assignees
Labels
Milestone

Comments

@Dimitar-Boychev
Copy link

Hello all,
When I do:

nodejs::install { 'v0.12.2':
                version => 'v0.12.2',
        }

Without master nodejs install with:

class { 'nodejs':
  version => 'stable',
}

on Ubuntu 14.04 the instal of node was OK and the symlink of /usr/local/bin in ok too:

node-v0.12.2 -> /usr/local/node/node-v0.12.2/bin/node*

But there is no npm-v0.12.2 in there ....
Is this expected or is it a bug...

@grafjo
Copy link
Contributor

grafjo commented Apr 17, 2015

I'm not sure what you wanna say ... nodejs v0.12.2 is delivered with npm 2.7.4 - see /usr/local/node/node-v0.12.2/lib/node_modules/npm/package.json

There is a symlink /usr/local/node/node-v0.12.2/bin/npm -> ../lib/node_modules/npm/bin/npm

Using the

class { 'nodejs':
  version => 'stable',
}

there are symlinks of /usr/local/bin/node -> /usr/local/node/node-default/bin/node and /usr/local/bin/npm to /usr/local/node/node-default/bin/npm

Using the define:

nodejs::install { 'v0.12.2':
  version => 'v0.12.2',
}

there are symlinks under /usr/local/bin including the node release number

@Dimitar-Boychev
Copy link
Author

This is what I get on Ubuntu 14.04 server

root@XXXXXXXX:/tmp# ls -l /usr/local/bin/
total 12
drwxr-xr-x  2 root root 4096 Apr 15 10:54 ./
drwxr-xr-x 14 root root 4096 Apr 15 10:58 ../
lrwxrwxrwx  1 root root   37 Apr 15 10:54 node-v0.12.2 -> /usr/local/node/node-v0.12.2/bin/node*
-rwxr-xr-x  1 root root  459 Apr 15 10:39 semver*
root@XXXXXXXX:/tmp#

@grafjo
Copy link
Contributor

grafjo commented Apr 20, 2015

for which manifest?

@stwomack
Copy link

I have this same issue. No symlink for npm, just node.

ll /usr/local/bin/ | grep node
lrwxrwxrwx 1 root root 37 Jul 20 10:54 node-v0.12.7 -> /usr/local/node/node-v0.12.7/bin/node
[nodejs@* ~]$ ll /usr/local/bin/ | grep npm
[nodejs@
* ~]$

The path IS on the nodejs user's path, but Puppet runs as root of course, so the PM2 module which includes this cannot execute npm

@JamesWiley
Copy link

I also have the same issue. I actually specified target_dir => '/usr/bin' and there are a couple of things missing:

  1. the symlink in /usr/bin is named node-v4.2.1 instead of just node
  2. there is no symlink to npm in /usr/bin

@mikijov
Copy link

mikijov commented Dec 7, 2015

It is possible that the problem occurs when installing from pre-built package with make_install => false. When I removed this line, node was compiled and then the links were created properly.

@Ma27
Copy link
Collaborator

Ma27 commented Jan 17, 2016

ok, could be reproduced. WHen installing Node 5 and Node 0.12 on a VM the following node executables are available globally:

  • node
  • node-v0.12.2
  • node-v5.4.1

But only one global npm executable (3.x which is shipped with node 5) is available.

@Ma27 Ma27 self-assigned this Jan 17, 2016
@Ma27 Ma27 added the bug label Jan 17, 2016
@Ma27 Ma27 added this to the 1.9 milestone Jan 17, 2016
@Ma27 Ma27 changed the title NPM not symlinked or I am stupid ? NPM executables not symlinked Jan 17, 2016
@Ma27
Copy link
Collaborator

Ma27 commented Jan 17, 2016

due to some weird internals of npm this bug is a bit harder to solve, so it may take a bit more time.

@Ma27 Ma27 added the can't fix label Jan 18, 2016
@Ma27
Copy link
Collaborator

Ma27 commented Jan 18, 2016

sorry, I have to close this as "can't fix".
There are many approaches to handle multiple node versions (this puppet module or tools like "nvm"), but I didn't found any approaches for multiple "npm" executables.

This is connected with a few issues:

  • Every npm executable would use the default interpreter (so npm2.x would use node 5 although it is shipped with node 0.12, https://github.com/npm/npm/blob/master/bin/npm-cli.js#L1)
  • There is no proper way to get the npm version (executing stuff in a puppet function won't work as they're evaluated first, so if node is already installed and running it after that it works, but not the other way round).

When trying to solve that, we would mess up the code for a case where no solutions are provided from the node side.

@Ma27 Ma27 closed this as completed Jan 18, 2016
@Ma27 Ma27 removed the in progress label Jan 18, 2016
@Ma27 Ma27 removed this from the 1.9 milestone Jan 18, 2016
@Ma27 Ma27 removed the can't fix label Jan 23, 2016
@Ma27 Ma27 reopened this Jan 23, 2016
@Ma27
Copy link
Collaborator

Ma27 commented Jan 23, 2016

we have to fix the documentation

@Ma27
Copy link
Collaborator

Ma27 commented May 5, 2016

in 2.0 it should be possible to fix this finally

Ma27 added a commit that referenced this issue May 27, 2016
@Ma27 Ma27 closed this as completed in #153 May 27, 2016
Ma27 added a commit that referenced this issue May 27, 2016
…right nodejs executable (#153)

- create templates which map the NPM executable to the corresponding NodeJS instance
@Ma27 Ma27 removed the in review label May 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.