Nodejs Version number update issue: Express is not an internal or external command

Source: Internet
Author: User


After the version number was updated, we installed it using the familiar NPM Install-g Express command, but after the successful installation, it was prompted that express was not an internal or external command.
Nodejs minor problem: [1]express is not an internal or external command
Nodejs minor problem: [1]express is not an internal or external command
Why is this so?

When we find the installed Express folder we find a lot less than the previously familiar express.
Nodejs minor problem: [1]express is not an internal or external command
Nodejs minor problem: [1]express is not an internal or external command
What do we do?

It was updated with the Express version number, but we didn't know what to do with the new version number. So I just need to remove the currently installed Express, and install the previous version number again. Test OK.
The commands used here are
Uninstall: NPM Uninstall-g Express
Install the specified version number: NPM install-g [email protected]
View version number: Express-v
Note that the V in Express-v is capitalized, otherwise it will not be recognized in very many version numbers
Nodejs minor problem: [1]express is not an internal or external command
Nodejs minor problem: [1]express is not an internal or external command
Nodejs minor problem: [1]express is not an internal or external command
Of course, you're just trying to solve the problem that the Express command doesn't recognize. You've reached your goal at this point. But why can't we use the new version number?
Originally, the new express4.0 version of the command tool was split out (Project address: https://github.com/expressjs/generator), so we also need to install a command tool, such as the following command:
npm install-g express-generator

So I deleted the previous express3.5.0 again install express4.0 and its command tools
Nodejs minor problem: [1]express is not an internal or external command
Nodejs minor problem: [1]express is not an internal or external command
Now that we've installed it, we're going to test it. The newly installed Express is not available
So I used express to create a project:
Express HelloWorld
Some changes have been made to the command in the new version number, and it is necessary to use NPM to join dependencies and start after creating project:
CD HelloWorld
NPM Install
NPM Start

Then the newly created HelloWorld is already executed on the 3000port
Nodejs minor problem: [1]express is not an internal or external command
Visit Http://localhost:3000/to see the familiar page.
Nodejs minor problem: [1]express is not an internal or external command
and the created folder effect.
Nodejs minor problem: [1]express is not an internal or external command
At this point really is done, express the new version number is really some changes. hehe. Other new features await us all to find out.

Precautions
You need to use NPM install-g [email protected] To install the specified version number.
Project created with Express must be able to use NPM install to add dependencies to the project folder to execute
Execution app is no longer node App.js but NPM start

Nodejs Version number update issue: 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.