INSTALL NODE.JS ON WINDOWS
2014-03-03 00:00
405 查看
摘要:在windows上安装Node.js
Tonight I was trying to install Node.js on Windows and couldn’t find any straightforward documentation. Reason is each new release of Node.js has multiple ways it can be setup. For instance, older versions required Cygwin and some people use a .exe file. None of these methods are optimal, so I’ve written a tutorial on how to install Node.js own Windows and test it in 6 steps with less than 10 minutes of your time.
Edit (2014-03-03):The below information is for Node 0.6 (including the code test sample). If you want to install the latest version just follow these simple steps and you should be good to go.
Go to the NodeJS home page
Click install to download the .msi installer package
Run it and follow the instrucitons, you now have NPM (node package manager) and Node.js installed
Reset your computer to get everything working in your command-line interface (CLI)
Go no Node.js‘s website and download the Windows .msi installer file. This is literally all you need setup everything.
Run Node’s .msi file from anywhere on your computer. An installation window will appear. All you need to do is agree to and click okay on everything. If your Node.js install is corrupted, you can re-run this file and select repair to fix it.
This is the step that everyone forgets. Once you’ve installed the .msi file you need to reset your computer. Failure to do so will prevent you from using Node in your command prompt. Wondering why? You need to flush Windows since its adjusting registry files and who knows what else under your computer’s hood.
test.js:Code example from http://nodejs.org home page.
To make sure your Node.js install works on Windows, create a simple hello world script with the above code. Call it test.js and store it somewhere easy to access on your computer. A location such as f:\nodeworkspace\helloworld.js will make your life easier when accessing the file via Windows Command Prompt. If you use a different location you’ll have to adjust the following examples.
Run your Windows Command Prompt and relocate to helloworld.js’s folder. Here you’ll need to run node helloworld.js. Running this line of code causes Windows to activate the file and output a message.
You probably noticed that running node test.js output a message identical/similar to Server running at http://localhost:8888/. To verify node is working correctly leave your command prompt running in the background, then copy and paste http://localhost:8888/ into your browser. This should display an image similar to the above picture. If it still isn’t working walk back through the above steps or leave a comment below for more help.
If you made it through the above steps there is nothing left to install Node.js on Windows. Your computer should run it fine and no further configuration is necessary.
Tonight I was trying to install Node.js on Windows and couldn’t find any straightforward documentation. Reason is each new release of Node.js has multiple ways it can be setup. For instance, older versions required Cygwin and some people use a .exe file. None of these methods are optimal, so I’ve written a tutorial on how to install Node.js own Windows and test it in 6 steps with less than 10 minutes of your time.
Edit (2014-03-03):The below information is for Node 0.6 (including the code test sample). If you want to install the latest version just follow these simple steps and you should be good to go.
Go to the NodeJS home page
Click install to download the .msi installer package
Run it and follow the instrucitons, you now have NPM (node package manager) and Node.js installed
Reset your computer to get everything working in your command-line interface (CLI)
Windows Installation Instructions
To install Node.js on Windows is quite easy. You’ll just need to grab an installer package from their website and run it. Well it isn’t quite that easy, but its close.Download node.msi Windows Installer
Go no Node.js‘s website and download the Windows .msi installer file. This is literally all you need setup everything.
Run node.msi Windows Installer
Run Node’s .msi file from anywhere on your computer. An installation window will appear. All you need to do is agree to and click okay on everything. If your Node.js install is corrupted, you can re-run this file and select repair to fix it.
Reset your computer
This is the step that everyone forgets. Once you’ve installed the .msi file you need to reset your computer. Failure to do so will prevent you from using Node in your command prompt. Wondering why? You need to flush Windows since its adjusting registry files and who knows what else under your computer’s hood.
Post Install Node.js on Windows
Just because you’ve installed Node.js doesn’t mean it works. In the next three steps, we’ll quickly walk through creating a test file and running it.Create a Test File
?1 2 3 4 5 6 | var http = require( 'http' ); http.createServer( function (req, res) { res.writeHead(200, { 'Content-Type' : 'text/plain' }); res.end( 'Hello World\n' ); }).listen(8888, "localhost" ); console.log( 'Server running at ' target='_blank'>http://localhost:8888/'[/code]); |
Run Windows Command Prompt
Run your Windows Command Prompt and relocate to helloworld.js’s folder. Here you’ll need to run node helloworld.js. Running this line of code causes Windows to activate the file and output a message.
Verify Install Node.js on Windows
You probably noticed that running node test.js output a message identical/similar to Server running at http://localhost:8888/. To verify node is working correctly leave your command prompt running in the background, then copy and paste http://localhost:8888/ into your browser. This should display an image similar to the above picture. If it still isn’t working walk back through the above steps or leave a comment below for more help.
If you made it through the above steps there is nothing left to install Node.js on Windows. Your computer should run it fine and no further configuration is necessary.
相关文章推荐
- node.js express install on windows 7
- 【转】Install Node.js and NPM on Windows
- How to install Node.js and NPM on Windows
- Step by step instructions to install NodeJS on Windows
- Windows node.js npm install express -g Cannot find module 'express'
- How do you install Node.JS on CentOS?
- kissy-node run on windows解决方案,contextify nodejs windows solution
- Windows node.js npm install express -g Cannot find module 'express'
- windows下node.js和express的install安装
- [译]How to Install Node.js on Ubuntu 14.04 如何在ubuntu14.04上安装node.js
- Install MongoDB and Node.js on a Raspberry Pi
- How to install Node.js on Linux
- Windows node.js npm install express -g Cannot find module 'express'
- Windows node.js npm install express -g Cannot find module 'express'
- Setup node.js on Windows Server
- Install nodejs on Linux Centos6.5
- How To Install Node.js on a CentOS 7 server
- install nodejs on ubuntu
- node.js install on linux 5.4
- Install NodeJS on Ubuntu 12.10