How to run Node.js after downloading binary version for Windows - node.js

If I downloaded Windows Binary version (.zip, node-v8.11.4-win-x64) from nodejs.org and unpack the ZIP, what the next should I do? I'm newbie in NodeJS and can't find the answer in the docs
I see the file node.exe inside of unpacked folder and as I know it's so-called "repl".
Where should I create the working folder for the projects and the file hello-world.js?
And in which Windows' terminal can I run the commands?
Windows 7 Home Premium 64-bit

You should put node.exe on your system PATH, that way you can use it from any directory. Here's a guide to edit path on Windows 7:
http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx
You can then start it in any CMD shell or in PowerShell.
To test, start a new CMD window, and type
node -v
This should give you the node version.
I'd suggest you create something like a Projects directory for your code in your \user dir, with a subdirectory per project.
Once you've all this in place, just navigate to your project dir in your chosen shell and :
node hello-world.js

Related

How to install Nodejs on CentOS 7 without Internet connection with root permission?

I've recently migrated to Linux CentOS7 from windows and I need to install Nodejs to my target, but in target system there is no Internet connection. How can I install Nodejs with all dependencies in offline mode? Thanks in advance for your answers.
you can download node.js binary from its website and you can copy that file using ssh to your target machine.
extract it and add its path to your environment variables.
for more details you can visit here
here is my procedure
To install NodeJS we need an online server to download requirements.
You can download it from Node’s official website. Make sure you download Linux binary version of it.
Or you can use this link:
https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz
After downloading Linux Binary, copy it to your offline machine.
Then go to the directory you copied and unzip your downloaded file by using tar command.
Next step we are going to define the unzipped directory to our environment variables.to do this first go to /etc/profile.d and create a file. its name should be nodejs.sh
Copy commands below to nodejs.sh file and save it.
#!/bin/sh
EXPORT PATH=/home/node-v16.14.0-linux-x64/bin:$PATH
Note : /home/node-v16.14.0-linux-x64/bin (file address) may differ from yours
Restart your session and then enjoy NodeJS on your offline Linux machine.

how to move workspace(a simple project) from windows file system (/mnt/) to linux (~/home)

I am developing a Django project (nothing) and trying to use using WSL2.
so if I use the Ubuntu Terminal from Windows to create a project and try running it in VScode, I got this little message,
I just don't know how to do that at all,
it's the first time I tried to use WSL2 (which is awesome), if someone could help, thank you very much.
If you have your project in some mounted folder -> linux path starting with /mnt/ e.g.
/mnt/c/Users/rasto/Desktop/some_folder/my_project/
When you open VS Code in this directory (via running command code . or opening the VS Code from windows) you get the warning:
This workspace is on the Windows file system (/mnt/). For best performance, we recommend moving the workspace to the Linux file system (~/home).
The solution is easy -> move/copy the project folder to ~/my_project/ directory:
In WSL terminal:
Recursively copy all files from source-path to destination-path and if the folder ~/my_project/ does not exists, it will be created
cp -R /mnt/c/Users/rasto/Desktop/some_folder/my_project/ ~/my_project
Move to the directory in your terminal
cd ~/my_project
And open VS Code from console with
code .
Note: To open VS Code from terminal you must have installe extension Remote Development extension pack
Note2: To access the linux folder from windows file explorer just right click in VS Code explorer and Reveal in explorer or with the path like: \\wsl$\Ubuntu-18.04\home\rasto\my_projects

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 install Node.js on Windows 10?

I tried to install Node.js on the Windows 10 64 bit using installer.
When I run installe.exe I accept rules and push next button, in any case I get the following notification:
When I tried to set path of downloaded install file:
And get this error again.
#Babaev From what you said, I guess its a problem related to path issue or rather the .msi file may have been corrupted on download. Try the windows binary that is .exe file from https://nodejs.org/en/download/ let's say we have the node.exe file located in the folder c:\nodejs. Now to setup npm-
Step 1: Download the latest npm release from
GitHub(https://github.com/npm/npm/releases) Step 2:Create folders
c:\nodejs\node_modules and :\nodejs\node_modules\npm
Step 3:Unzip the
downloaded zip file in c:\nodejs\node_modules\npm folder
Step 4:Copy
npm and npm.cmd files from c:\nodejs\node_modules\npm\bin to c:\nodejs
folder.
Step 5: As the final step you can add node's folder
pathc:\nodejs to the path environment variable so that you don't have
to specify full path when running node.exe and npm at command prompt.
Hope this helps :)

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

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

Resources