I know this is an old problem, and I've gotten so far with other answers, so I'm using nvm for windows, I have my Node V11 and Node V12 versions installed, but when I do:
nvm use 11.15
The windows User Escalation popup comes up saying "Do you want to change the settings for CMD.exe?".
Ideally, I'd want to just switch the environment of my current process (from VSCode Terminal) or possibly use the nvm tool in a batch file to ensure that I can run different NodeJS solutions side-by-side on the same machine i.e. using different versions of node at the same time. Is this possible without requiring admin escalation?
Thanks
Related
I'm struggling to understand how exactly WSL works.
The training that I'm doing requires nvm so I can manage my node versions in my project, located in my hard drive that is running with Windows.
So, in order to use nvm I need WSL, but I cannot comprehend where it is located. As far as I understood (and I'm pretty sure that I'm wrong) the WSL that I installed is like a Linux VM, completely independent from my Windows, and I operate it through the Ubuntu Terminal that came with WSL. If that's the case, how can nvm in WSL be useful if my project is in my Windows directory and the WSL controls node versions from my Linux VM?
How do I make nvm useful for my project running from my C:\ drive and how does WSL work with nvm in my Windows?
Thank you!
A few options, but each has advantages and disadvantages:
If your Node/JavaScript files are on your Windows C:\ drive, then you do have the ability to access that from WSL. Windows paths are automatically mounted and accessible in WSL via /mnt/c, /mnt/d, etc.
So if you have your JS source in, for example:
C:\Users\<myusername>\Documents\Projects\JS_class\project1\
Then that would be accessible under Ubuntu in WSL via:
/mnt/Users/<myusername>/Documents/Projects/JS_class/project1/
The disadvantage here is performance, as mentioned in this question.
Alternatively, you can store your project files inside WSL. You can access the WSL path from Windows by using \\wsl$\Ubuntu\home\<yourusername>\ (or similar). You can use this to copy from your existing Windows drive to your WSL distribution.
Advantage: Faster. Disadvantage: Unknown -- You seem to want the files to be in Windows, but I'm not sure why.
Or you can use WSL1 for most Node/JS tasks. See the previously mentioned answer for details on how to convert.
Advantage: Speed
Disadvantage: WSL1 hasn't been updated in a while, and is started to run into some compatibility issues. It's still popular enough and stable enough at the moment for me to continue to recommend it, though.
There's also a Windows version of nvm as well as a replacement project that the repo there mentions. I cannot personally speak for the quality of it, but it does have 23k stars on Github. Note that it is not affiliated with the original (Linux-based) nvm project.
I installed Node.js on Windows version v14.15.5 for a project without checking anything on the prompts during the installation. Then at some point Node.js automagically updates to latest version v16... Any way to disable this update regardless what is happening in the code of the project or elsewhere in the system. Just wish to always keep same version that was installed or specific version, in this case v14.15.5. Thank you
Except nvm there is another reason for the automatic update.
Disclaimer: In my case it was Chocolatey.
Chocolatey can be installed as last step of node installation.
You should be able to stop this with chocolatey pin command.
Something like this:
choco pin add -n="nodejs"
choco pin add -n="nodejs.install"
I have a VS 2015 solution which requires I have the newest version of nodejs installed externally, and added to the External Web Tools path. (web project using a packages.json and gulp file to retrieve css/js modules and compile ssas at build time)
I also have older solutions that uses older versions of modules, and worked with the default versions of npm(1.4.9) and node(0.10.31). Once I installed newer nodejs externally and added to External Web Tools path, npm now throws various errors. As I work through errors I tend to to end up at github issues where someone had opened an issue and the responses were "you're using too old a version of node/npm".
In an ideal world we'd work through the old projects to get them on newer versions but this has a larger impact than is feasible.
Is there a way to specify that some projects use the default node/npm while other projects use the newer? I.e. a way to make the External Web Tools paths a proj/sln level setting instead of being a global Visual Studio setting.
You can use something like nvm.
In your project root directory, you would setup a .nvmrc and you would just set the version number in there. For example my file would have v10.9.0, and then I would just go into the directory and from the command line type the following:
nvm use
You can also have nvm set your npm version as well. See this answer
You can use Node Version Manager(NVM) to solve your problem
NVM allow to run multiple node version in single machine, You can switch on any node verion using NVM
for more information you can refer
https://medium.com/appseed-io/how-to-run-multiple-versions-of-node-js-with-nvm-for-windows-ffbe5c7a2b47
I'm trying to set up a create-react-app project on my 918+ Synology NAS. From the getgo it has Node.js 5.6.0, but since create-react-app requires >=6 I need to install and use a higher version. Within the Synology NAS the Package Manger has both Node.js 6 and 8. These install fine. Then I'm trying to change the current Node.js version, this is where the problems starts.
For the information, the Synology runs a custom distro of Linux called DSM, with kernel 4.4.59.
When trying to change to version using e.g. nvm use 6.12.3 I get:
Error: Could not open history file.
REPL session history will not be persisted.
Googling this gives me no results. Is there somewhere here that would happen to know what to do, or just could try help me get this set up? I'm not sure if it's even possible. The Synology has Docker, would that be a better option for me?
I'll be attending a MS course tomorrow and I'm supposed to install NodeJs version 0.12.7. However, when I follow the link provided, I only get a directory listing of a bunch of files. And I'm certainly not sure which one(s) I need (I'm on Win 8).
I also tried with their front page but the versions advertised there are v.4.2.2 and v.5.0.0, which surprised me (cf. v.0.12.7). When I went to the downloads' section, I got totally confused by the overwhelming number of options, platforms, versions etc.
I trust my godlike ability to pick just the wrong option as well as my superpower of confusing everything to the edge of ridiculousness, so instead of cursing my rectum off, I prefer to ask straight how to obtain the requested version (v.0.12.7 for Win 8).
I would suggest nvm, it's great for node version management and installing any particular version of node you would like. https://github.com/creationix/nvm
If you're running 32-bit Windows, then you want the node-v0.12.7-x86.msi file in the directory in your link.
If you're running 64-bit Windows, then you want the node-v0.12.7-x64.msi file in the x64 subdirectory.
As #Ryan McDermott suggested, nvm is good. Another option, which I like, is nodenv: https://github.com/OiNutter/nodenv.
First, install nodenv. Then, install the plugin node-build (https://github.com/OiNutter/node-build). Then you can do the following:
nodenv install --list # list available node versions
nodenv install 0.12.7 # install the specified version
nodenv global 0.12.7 # use the specified version of node