Nodejs version update problem: express is not an internal or external command, nodejsexpress

Source: Internet
Author: User

Nodejs version update problem: express is not an internal or external command, nodejsexpress

After the version is updated, we use the familiar npm install-g express command to install it. However, after the installation is successful, the system prompts that express is not an internal or external command.
Nodejs: [1] express is not an internal or external command
Nodejs: [1] express is not an internal or external command
Why? When we find the installed express directory, we find that there are much fewer things than the familiar express.
Nodejs: [1] express is not an internal or external command
Nodejs: [1] express is not an internal or external command
What should we do? I guess the version is updated, but we don't know how to use the new version. So I have to delete the currently installed express and reinstall the previous version. Test OK.
The commands used here include:
Uninstall: npm uninstall-g express
Install the specified version: npm install-g express@3.5.0
View version: express-V
Note that the value of V in express-V must be capitalized. Otherwise, it will not be recognized in many versions.
Nodejs: [1] express is not an internal or external command
Nodejs: [1] express is not an internal or external command
Nodejs: [1] express is not an internal or external command
Of course, you just want to solve the problem that the express command cannot be identified. Now you have achieved your goal. But why can't we use the new version?
Originally, the latest express4.0 version of the command tool out (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 and installed express4.0 and its command tools again.
Nodejs: [1] express is not an internal or external command
Nodejs: [1] express is not an internal or external command
Since the installation is complete, we need to test whether the newly installed express can be used.
So I used express to create a project:
Express helloworld
The commands in the new version have changed. After creating a project, you need to use npm to add dependencies and start them:
Cd helloworld
Npm install
Npm start

Then the newly created helloworld is running on port 3000.
Nodejs: [1] express is not an internal or external command
Visit http: // localhost: 3000/To see the familiar page.
Nodejs: [1] express is not an internal or external command
And the Created directory effect.
Nodejs: [1] express is not an internal or external command
Now, the new express version has changed a little. other new features are waiting for us to discover.

Notes
A command like npm install-g express@3.5.0 is required to install a specified version
To run a project created with express, you must use npm install to add dependencies to the project directory.
Running an application is no longer a node app. js, but a npm start

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.