Finishing Node Getting Started» A comprehensive node. JS Tutorial-Problems with demo practice

Source: Internet
Author: User

Spent a morning reading [reprint]node Getting Started» A comprehensive node. JS Tutorial

According to the inside of the demo itself manual implementation process or need to write questions, special finishing in this.

<1> Because the Node.msi installation package has automatically added system environment variables, you can run node Xxx.js anywhere in the path.
<2> Determine if 2 environment variables have been added
(1) One is the directory that adds node.exe on path C:\Program Files\nodejs, (added automatically)
(2) One is to increase the environment variable Node_path, the value is C:\Program files\nodejs\node_modules (the environment variable does not seem to be necessary.) )

But C:\Documents and settings\xxx\application data\npm This folder path must be required, manually established, otherwise the error occurs when you execute NPM:

Error:enoent, stat ' C:\USERS\ADMINISTRATOR\APPDATA\ROAMING\NPM.

<3> To install the module via NPM It is important to note that CMD switches to the destination folder where the project is located, such as installing the ' formidable ' module:
G:\Study\12.NodeJS\MyDemos\01.NodeJSBlog > NPM Install formidable
This will generate the \node_modules\formidable folder under the current project file.

<4> Upload a folder path problem

function upload (response, request) {  Console.log ("Request handler ' upload ' was called.");  var form = new Formidable. Incomingform ();  Form.uploaddir = "./tmp/"; Add: Need to set the relative path of the upload folder  console.log ("About to parse");  Form.parse (Request, function (Error, fields, files) {    Console.log ("parsing done");    Fs.renamesync (Files.upload.path, "./tmp/test.gif");    Response.writehead ($, {"Content-type": "Text/html"});    Response.Write ("received image:<br/>");    Response.Write ("

At this point, the demo runs successfully, the file is uploaded and displayed successfully.

Nodejs Community
http://cnodejs.org/
http://cnodejs.org/
http://yuan.rednode.cn/

Finishing Node Getting Started» A comprehensive node. JS Tutorial-Problems with demo practice

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.