Nodejs version Update issue: Express is not an internal or external command

Source: Internet
Author: User


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.
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 directory, 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? 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
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 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
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 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.
Nodejs minor problem: [1]express is not an internal or external command
Visit Http://localhost:3000/and see the familiar pages.
Nodejs minor problem: [1]express is not an internal or external command
and the created catalog effect.
Nodejs minor problem: [1]express is not an internal or external command
This is really done, and the new version of Express has changed a little. hehe. Other new features await us all to find out.

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

Nodejs version 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.