Nodejs small problem: Express is not an internal or external command

Source: Internet
Author: User

On the spur of the moment want to learn something, ready to deploy a node. js applet on Heroku. The company computer was not installed with node. js, so download the latest version of node. JS, When I installed express I found that it was not an internal or external command. Then after my tireless efforts, finally found clues, the following share to everyone (I am using the Windows node. js).

Tools/Materials
    • node. JS installation Package
Method/Step
  1. First download the node. JS installation package, here I use the official latest v0.10.27

    32-bit version:

    Http://nodejs.org/dist/v0.10.27/node-v0.10.27-x86.msi

    64-bit version:

    Http://nodejs.org/dist/v0.10.27/x64/node-v0.10.27-x64.msi

    The next step in the installation is not to elaborate.

  2. After installation, you will need to install Express and install it using the familiar NPM Install-g Express command, however, after the installation is successful, you are prompted that express is not an internal or external command.

  3. Why is this so? When we find the installed Express directory, we find a lot less than the previously familiar express.

  4. What do we do? The speculation is that the Express version is updated, but we don't know how to play the new version. So I had to remove the currently installed express and reinstall the previous version to try it. Test OK.

    The commands used here are

    Uninstall: NPM Uninstall-g Express

    Install the specified version: NPM install-g [email protected]

    View version: Express-v

    Note that the V in Express-v is capitalized, otherwise it will not be recognized in many versions

  5. Of course, you just want to solve the problem that the Express command does not recognize. You've reached your goal at this point. But why don't we use the new version?

    Originally, the command tool was separated from the latest express4.0 version (Project address: https://github.com/expressjs/generator), so we also need to install a command tool, the command is as follows:

    NPM install-g Express-generator

    So I deleted the previous express3.5.0 again install express4.0 and its command tools

  6. Now that we've installed it, we need to test whether the newly installed Express is ready to use

    So I used express to create a project:

    Express HelloWorld

    There have been some changes in the command in the new version, and after creating project, you need to add dependencies and launches with NPM:

    CD HelloWorld

    NPM Install

    NPM start

    Then the newly created HelloWorld is already running on Port 3000.

  7. Visit Http://localhost:3000/and see the familiar pages.

  8. and the created catalog effect.

  9. This is really done, and the new version of Express has changed a little. hehe. Other new features await us all to find out.

    END
Precautions
    • Use the NPM install-g [email protected] command to install the specified version
    • Project created with Express must use NPM install to add dependencies in the project directory to run
    • Running the app is no longer node App.js but NPM start

Source: http://jingyan.baidu.com/article/922554468a3466851648f419.html

Nodejs small problem: Express is not an internal or external command

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.