Install Node.js on a different hard drive from C to D - node.js

I have node and npm with existing packages currently installed to the C drive on Windows. My C drive is an SSD with a low amount of space. How can I move the node installation to a different drive? Would I need to reinstall node and all packages? The current node installer doesn't seem to specify drives.

You can move the node.exe to the d drive. Then check your environment path. Type set in a command window or in computer properties. Make sure you have the folder that contains node.exe in your path. Running node in a command window will work from any folder then.
For installed npm packages, ie.. node_modules folder.. That just needs to be in a directory above where your writing your code, so try putting that folder in d:\ Assuming your going to be writing your apps on the d drive now.
In .npmrc file, change prefix setting to desired folder. Global packages get installed in node_modules under that folder

I'm not sure what you are talking about, the node installer has this page.
What version of node are you trying to install? This screenshot is taken from v0.11.7 of node.

I know this post was basically forever ago, but I found a much easier way than manipulating the path. Simply uninstall NPM using the npm uninstaller, reinstall on your other drive with a new folder called nodejs. It'll create the folder in there appropriately and npm will be successfully installed on you D drive.

Search -> Environmental variables of system
click on path ( both )
click on new
add the path of your node.exe file
boom you are done*
node -v to check

Related

Install multiple versions of Node.js on Windows without using NVM for Windows

I haven't been able to find any questions/answers regarding how to install two versions of Node.js (such as v10 and v14) on the same computer without using NVM. I can't use windows-nvm because it requires admin privileges, and I'm working on a company laptop as a standard user.
I need to be able to install multiple different versions of Node.js because different projects under the same company use different versions of Node.js as a necessity.
Is the only way to uninstall the installed version and install a new version every time? Is there any way I can have v10 under C:\Program Files\node10, and v14 under C:\Program Files\node14?
To be clear, the admins are willing to grant me specific privileges or install any software needed in order to get this working. We have tried using something called RunAsTool to try to let me run NVM as an admin, but this doesn't work because of its limitations.
Another option would be to grant me admin rights to any files and directories needed for NVM to function, but there is no list of those files/folders that I can find.
A third option would be to simply install two different versions, but when you install a new version, the previous version gets removed, even if it's installed under an unusual path like C:\Program Files\node16.
There's no easy way to do this, I think. Broadly you need two things to get node working on Windows: the nodejs folder with the executable in it, by default c:\Program Files\nodejs, and the path to that to be on the system path before any other node paths.
Unfortunately both writing to c:\Program Files and changing the system path require admin rights.
However, there is a somewhat clunky workaround. The overall idea is to put the nodejs folder somewhere where you have write access, point the system path at it, and it should run. Then you can switch versions without admin rights by replacing the folder. To do this:
With admin, install the first version you want to use. Copy the c:\Program Files\nodejs folder somewhere where it won't get deleted on a new install: say c:\nodejsbackups\v10\nodejs if it's version 10.
Install the second version you want to use, and copy the nodejs file to the same place, say c:\nodejsbackups\v14\nodejs.
Also copy it to a place you will run it from and where you have write access, say c:\nodejs if you have write access on the c: drive, or your user profile somewhere if not.
Still with admin rights, edit the system Path environment variable (NOT the user path). Find the entry to c:\Program Files\nodejs and remove it. Add an entry for c:\nodejs. Or just edit it.
I found that to get Visual Studio node apps to work I then had to also uninstall the original node using Control Panel/Programs and Features.
Now fire up a command prompt and do node --version and npm --version and you should see the second version is working.
To switch versions, without admin delete c:\nodejs and then copy the first version to there from c:\nodejsbackups\v10\nodejs. Restart your command prompt, issue the same commands, and you should see the first version is now working.
This seems to work on some very limited testing, but I think you need to test it all works for your use cases. There may be programs like Visual Studio that assume node is at c:\Program Files without using the path. In the end it may be better to beg for admin rights.
Install here:
Delete %NVM_HOME% and %NVM_SYMLINK%
Add path relative
Enjoy :)

How to install node.js in a custom directory through powershell?

I am making a script to install NodeJS on several machines through PowerShell.
By default NodeJS gets installed in C:\Program Files\nodejs folder. Can I define a custom directory for the installation?
I am running this command:
msiexec.exe /i $nodejs_download_filename /L*V "logger.log" /passive | out-null
Is there any argument to add to this line in order to specify the target directory instead of the default one?
You can refer this
Install Node.js on a different hard drive from C to D
You can move the node.exe to the d drive. Then check your environment path.
Type set in a command window or in computer properties.
Make sure you have the folder that contains node.exe in your path.
Running node in a command window will work from any folder then.
For installed npm packages, ie.. node_modules folder..
That just needs to be in a directory above where your writing your code, so try putting that folder in d:\ Assuming your going to be writing your apps on the d drive now.
In .npmrc file, change prefix setting to desired folder. Global packages get installed in node_modules under that folder.

How to remove entire files and folders created for the nodejs and npm installation

I don't know what happend. All of a sudden, my nodeJS and npm started not responding and many errors popup and i reinstalled many times and not yet that works. When one problem solves, another rises. So i want to clean enitre setup files including in registery and other areas. Please someone help me.so i can reinstall node and npm.
To remove node from your window follow below instructions
1- Uninstall node from Programs & Features with the uninstaller.
2- Remove all the shortcuts like on task managers/ desktop etc
3-Reboot your system
4-Remove all the folder given below
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)
5-Remove from the environment variable via checking Path value
6-Open your command prompt try to run below command
where node
If it will show directories then delete all the directories
7-Reboot your system
8-Go to the node js side download or directly install the node from there.

Can not use or uninstall Node.js

I am using windows and installed Node.js a while ago and I now can not use it or uninstall it as it is on drive D:\ which is no longer with me. I have looked at the windows regedit solution but could not find anything of use in there.
go to registry editor-->HKEY_LOCAL_MACHINE-->SOFTWARE and delete nodejs
go to Window +r then enter command regedit and go to registry editor-->HKEY_LOCAL_MACHINE-->software and change instalPath then uninstall and install again node js
go to registry editor >HKEY_LOCAL_MACHINE > Software and delete the folder
when you go to re-install Node.js from the windows install package, the installer asks you where you want the install to be placed. Right now, I'm assuming you are presented with D:[some directory]. there should be a button located directly below the textbox showing the current install path. click that and pick a new location for your install. For instance mine is set to C:\nodejs.
EDIT
Check your environment variables for any paths that reference D:\ in association to Node and remove them

Reinstalling node.js in windows from scratch to a NEW/DIFFERENT folder

I need to reinstall nodejs in windows 7 in a shorter character folder (closer to root, that is) than the one previously used since the character length is giving me problems with some packages.
However, when I reinstall, npm always installs in the PREVIOUS folder. How can I perform a new, fresh installation? Specifically, where I can select the folder where the packages will be installed?
Thanks.
I just found out about:
npm config set prefix C:\blahblahblah
Hope this solves my problem.

Resources