I am starting to learn Nodejs and tried to install it.
Now, when I do node -v I get v4.4.4 and when I do nodejs -v, I get v0.10.45
which node gives /usr/local/bin/node, which nodejs gives /usr/bin/nodejs
I need v4.4.4. Because of those different results I am not sure to start.
What can I do?
I recommend installing NVM (node version manager). It makes dealing with multiple node version installations really nice. Digital Ocean has a good tutorial on doing that here:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server
Once you've installed NVM you can likely remove your other node versions and all of your programs that use node will default to whatever version you set as the default with nvm.
Related
I'm trying to install node version 8 (node#8) on my mac through homebrew.
My current version of node is 13.6.0, which I downloaded through homebrew, and I'd like to be able to switch between node 8 and node 13 versions for different projects.
However, when I try to download node#8 using
brew info node#8
I get the following error
Error: No available formula with the name "node#8"
To diagnose why, I ran
brew search node
And I was shown the following
libbitcoin-node node ✔ node-sass node#12 nodebrew nodenv
llnode node-build node#10 node_exporter nodeenv
It looks like my current version of node can't even search for #8. That being the case, I'd like to know two things.
What is the best homebrew (or otherwise) command sequence to get node8 on my machine, given my version of homebrew can't find node8 using brew search?
What sequence should I use to switch between the node 8 and node 13 versions on a project by project basis?
Use NVM - Node Version Manager
https://github.com/nvm-sh/nvm
You can set your default Node version and install any other versions you like.
Switching off your default version is as easy as nvm use 10.12.0 or whatever version you wish.
I have been using n for a long time now. Dead simple. To install node 8 just type:
$ n 8
https://www.npmjs.com/package/n
Using node.js, I wanted to create a kiosk application with a RFID Reader attached to the kiosk. In order to access my RFID Reader, I installed the node-hid library (https://github.com/node-hid/node-hid). However, when I tried to run the application, an error occured, says:
Uncaught Exception
Error: The module 'D:\Projects\Electron\SelfService\node_modules\node-hid...\build\HID.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js required NODE_MODULE_VERSION 73.
I already updated the library and the node.js version to the latest update, but since the library is kinda old, it doesn't get any more update.
I tried to downgrade the node version, however there aren't any helpful tutorial I can find out there. I know there are many tutorial that explained how to install the older version of node, but I can't simply know what version of node I need from the error message displayed above.
I need to get the device readable by the application. If somehow, it's impossible to use the node-hid library, what is the latest library you recommended to access the RFID Reader from the application?
Note: I'm familiar with web development, including Javascript language, but Node.js is a new experience for me. I'll try my best to provide informations regarding my project, but if there are some mistakes with how I described my problem or if I have some difficulties in understanding your answers, please bear with me.
EDIT: I forgot to mention I'm on Windows 10, the node version I installed is 10.16.3
First Try this command -
Uninstall the electron first then try below command
sudo npm install --save-dev electron#4.0.0
sudo npm i --save-dev electron-releases#4.0.0
And also try to update chrome
Above is solution be sure minimum using Linux 16.04 with x64 processor and for npm version change see below
For NPM Version Downgrade of Linux/Ubuntu
sudo npm install -g npm#version
example-
sudo npm install -g npm#6.9
For Windows - start command prompt administrator
npm install -g npm#version
example-
npm install -g npm#6.9
You can uninstall the current node and then re-install the desired node version.
But the best practice will be installing node.js using the nvm aka node version manager.
Using nvm you can easily switch between different node version as well as different npm version.
Here's a quick start for installing node using nvm in both
windows, linux and unix platform.
NVM Official doc for unix and linux.
NVM alternative for windows
I download Node 10.11 a few weeks back and I have a repo that requires me to have the LTS version of Node of 8.12 at the time of this question. if I download the LTS will that mess up the install I have already or will it overwrite it? I'm using a Mac with High Sierra Also without using NVM
You can use nvm and have multiple versions of node on the same machine and switch by doing "nvm use version".
I can't comment yet, but to answer your question posed to Giorgos...
"So can I install NVM without uninstalling the version of Node I have already on my mac? "
Correct. NVM allows you to install whatever versions of Node you want and switch between them whenever you want. You can also set it so certain projects run a specific Node version so you don't have to worry about switching between versions if you are jumping between projects.
This allows you to have old versions, say 0.12 for random things, but also have Node8.x.x for your one project, and Node 10.x.x for another. It is incredibly useful, and if you ever need to verify compatibility with a new version, you can install the Node version via NVM and run your tests/project with that version of node. If it works, you can stick with it, if not you can switch back and look into updating your code to work with a new version.
I know that these are some similar / duplicate responses when searching for a solution to this. But the Node world seems to update so regularly that any answers I've found are refering to a much older version.
I'm currently running:
Node v6.9.1
Node Inspector v0.12.8
The error I get is as follows:
Detached from the target
Remote debuggng has been terminated with reason: websocket_closed
please re-attach to the new target
I had an identical issue. After digging around on some forums, I found that downgrading to Node v6.3.1. Here
So the next question was "How do I manage versions of node". Plenty of results show up with nvm. Stack Overflow has a post on it here.
None of the version managers for windows are kept up with. I found another one that is kept up to date (as of 1/1/17). I posted that answer here
Back to the original problem, with the nvm-windows installed:
nvm install v6.3.1 //I was running 6.9.1 - downgrade
The utility downgrades your npm version
Downloading npm version 3.10.3....complete
Installing npm v3.10.3
Then use it
nvm use 6.3.1
Note - I use a bunch of IDEs / Editors (depending on what I am doing). Editors such as Atom or WebStorm which have a Terminal / Command prompt embeded in it will need to be restarted AFTER you install nvm-windows in order to get access to the environment command "nvm".
Once you have node downgraded, the node-inspector worked find for me:
node-debug server.js
Maybe node with higher version(6.9.1) built in inspect, and node-inspect don't update longer..
solution:use node --inspect yourapp replace node-inspect & node --debug yourapp
It worked for me.
you can see Github issues Detached from the target, websocket_closed, cannot read property ref of undefined (NM[0] is undefined)
I'm trying to install node.js on a friend's computer. We had an old version (0.4.*), then installed n to update to a more recent version of node using n - node version manager
now instead of having an old version of node, we get
$ node -v
Segmentation fault
$ n --version
1.2.1
$ npm --version
Segmentation fault
When we type n the versions we installed show up but they are all greyed out. What's a Segmentation fault, why is it happening and how can we fix it?
Unless you're using something with binary dependencies (npm doesn't), segmentation fault means on of two things:
there is a bug in node.js core, and it should be reported
your node.js installation is broken
So you can solve this by reinstalling the most recent node.js version using a standard way from nodejs.org website. If it still segfaults (highly unlikely, but possible in some non-standard environments), report it to node.js core team.