I installed node and npm using the instructions provided here
I was able to use node successfully. However, as I attempt to install the "Formidable" node module, I get the following error:
$npm install formidable
bash: /usr/local/bin/npm: /usr/local/bin/node: bad interpreter: No such file or directoryWhen I do a which npm I get the following output:
$which npm
/usr/local/bin/npmI have no clue on what is wrong with npm here - any idea on how I can fix this?
54 Answers
Taking @gertvdijk hint, I uninstalled NPM using the script:
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*(which can be found here)
Even after performing the above, I got another error:
$ npm install formidable
bash: /usr/local/bin/npm: No such file or directorySo, I ran hash -r in the terminal (as per the instructions found under NPM Won't Run After Upgrade) and voila - it worked. NPM now works!
Ubuntu and some Linux distributions install node's interpreter as /usr/bin/nodejs, and not /usr/local/bin/node.
You can solve this issue installing the nodejs-legacy package which creates a symlink from /usr/bin/nodejs to /usr/bin/node.
Solution:
sudo apt-get install nodejs-legacyReferences:nodejs-legacy package
1step 1: run npm -vo/p : Error: bash: /usr/local/bin/npm: No such file or directory
step 2: run which npmo/p: /usr/bin/npm
step 3: run hash -r then run npm -vo/p : 3.5.2
It appears that you've installed another Node version from source some time earlier. This is indicated by the /usr/local/bin path where it appears to be installed now.
- Uninstall the one you installed from source. See the instructions that got with the source on how to do so. There's no single way on how to uninstall software scripts installed which don't work with your system's package management.
- Install the packages with are listed in the instructions you linked to in your question.
- Verify that
which npmnow lists/usr/binas installation path.
In general you should never have to install packages from source. And if you do, please be aware of the consequences as you're overriding the package management here an it will get confused by it.