NodeJS's initial experience difficulties and nodeJS's initial experience

Source: Internet
Author: User

NodeJS's initial experience difficulties and nodeJS's initial experience

Because the new company needs to use nodeJS, I just learned it. Let's take a look at nodejs Baidu encyclopedia first. We know that it is a js environment executed on the server side. The following are pitfalls:


The first pitfall is that after nodejs is installed, the environment variable of path will be automatically configured. I checked the path and found that the path is automatically added. Therefore, I run the command directly in the Command window and the result is "not an internal or external command ". I thought that because nodejs is installed in the C: \ Program Files directory by default and the folder has spaces, I uninstalled nodejs and installed it on disk D, it is found that the path has been configured in the new installation directory, but "not an internal or external command" still appears ".

Path:


Finally, restart the computer and solve the problem. (Above I used cd to the installation directory)


The second pitfall is that after I jump to the installation directory through cd, the file is executed directly, and the file to be executed is on the desktop, so the problem occurs.

There are two ways to solve this problem: first, the directory jumps to the directory of the executed file through cd. 2. Copy the executed file to the installation directory.

Hello. js has only one sentence: console. log ("Hello World ");

========================================================== ======

To sum up:

1. First install nodejs on the official website. Everything is installed by default.

2. Create a New hello. js file at any location. The file content is console. log ("Hello World ");

3. Restart your computer (important)

4. Go to the "hello. js" directory on the command line and execute "node hello. js.

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.