每次我创建一个新的angular 2项目时,它说“node_modules显示为空,你可能需要运行`npm install”
In your angular project, you have a file called package.json
. this file is responsible for holding track of your projects dependencies .
When you run npm install
, Node Package Manager , or npm for short, will download those dependencies and put them in node_modules
folder.
You need to run npm install to install the dependencies. May be refer to https://docs.npmjs.com/cli/install .
Consider using the Angular CLI to build your application instead. Then you won't need to use npm install
when building a new application.
See this for more information: https://github.com/angular/angular-cli/wiki
Once you run the ng new my-project
. Just give it some time to install the dependencies into the node_modules folder, which shows the below message.
Installing packages for tooling via npm
You will get the following message once it is done:
Installed packages for tooling via npm. Project 'my-project' successfully created.
Now try running the ng serve
. It should work fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.