Build a node. js and npm working environment in windows, node. jsnpm

Source: Internet
Author: User

Build a node. js and npm working environment in windows, node. jsnpm

Recently, after studying the data visualization D3 framework, I decided to build a node. js and npm working environment under windows. I checked n Articles on the internet, regardless of whether to compile the source code for installation or use node. there is always a problem with the installation package in the msi format. In the end, the building is complete. As a newbie, I don't know if this is the case or not, but running 'npm install' does not go wrong.

The following describes some of my building processes:

  1. Download node. js. Download the latest node.exe file at http://nodejs.org/download /.v0.10.33. After the download is complete, create a new nodejs folder on the fdrive and put node.exe in this folder. At the same timeF:\nodejsAdd it to the PATH of the environment variable.
    2. Download npm. Download the latest version of npmat http://nodejs.org/dist/npm. The version I downloaded isnpm-1.4.9.zip. After the download is complete, decompress the package to the nodejs folder to form the following directory and add the environment variable.NODE_PATHThe value is:F:\nodejs\node_modules

  2. To test whether the installation is successful, enternode -v,npm -vTo check whether the version numbers of both are output. if the version numbers are output, the table is output successfully.
  3. Due to XXX, you may often encounter downloading packages when using them. Therefore, it is best to set npm domestic images. The command is as follows:

     npm config set registry http://registry.npmjs.vitecho.com

    4. Test. Create a directory and create a new file under the directory.package.json, The content is as follows:

     {     "name": "d3-project-template-with-grunt",     "version": "0.0.1",     "description": "Ready to go d3 data visualization project template with grunt",     "keywords": [         "data visualization",         "d3"     ],     "homepage": "<project home page>",     "author": {         "name": "<your name>",         "url": "<your url>"     },     "repository": {         "type": "git",         "url": "<source repo url>"     },     "dependencies": {         "d3": "3.x"     },     "devDependencies": {         "grunt": "~0.4.1",         "grunt-contrib": "~0.4.0",         "grunt-contrib-uglify": "~0.2.2",         "grunt-contrib-concat": "~0.3.0",         "grunt-contrib-sass": "~0.4.1",         "grunt-contrib-jasmine": "~0.5.1",         "grunt-contrib-jshint": "~0.4.0",         "grunt-template-jasmine-istanbul": "~0.2.5"      },     "scripts": {        "test": "grunt jasmine"     } }

5. Switch to this directory on the command line and runnpm installIf an error is reported and an error is automatically creatednode_modulesDirectory andnpm-debug.logFile, and downloaded a bunch of files, it proves that the use is completely correct.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.