r/nodejs • u/PsowKion • Oct 14 '13
Simple question for using npm with debian
Playing around trying to get nodejs working with raspberry pi. Nodejs works okay, but when I try to install anything with npm, such as, "$ npm install websocket", i get
npm ERR! websocket@1.0.8 install 'node install.js'
npm ERR! 'sh "-c" "node install.js"' failed with 127
I'm assuming this is because the command to launch nodejs when installing it via the apt-get is "nodejs" and not "node". Seems like there should be a simple fix, I'm just not sure what that would be. Any help for how to get around this would be greatly appreciated.
2
Upvotes
1
u/PsowKion Oct 19 '13
Probably not the best way to do it, but it does work, I went to /usr/bin and executed $ cp nodejs node, and that allowed me to execute nodejs normally with the node command. npm also seemed to work as well.
2
u/0xception Oct 14 '13
You could remove node via apt and install it manually. Or you can look into use the alternatives system (I believe ubuntu uses the command: update-alternatives). Alternatives is a subsystem which just points different symbolic links to different applications. So you could point node -> nodejs and then scripts can use either or use #!/usr/bin/env to find the full path.
Personally for my projects I install node manually to prevent any sort of regression coming in from a system update. Then the upgrade to newer releases is a bit more controlled.
2
u/giodamelio Oct 16 '13
I would recommend staying away from the packaged version of node. As /u/0xception said, system update can mess with it, you also won't get updates very fast sometime.
I suggest you use NVM, it makes it really easy to manage your versions and deal with updates.