简体   繁体   English

Angular 2 Cli:ng服务错误

[英]Angular 2 Cli: ng serve error

I have created new Angular 2 application with angular-cli like this: ng new PROJECT_NAME But when I run ng serve , it displays this error: 我用angular-cli创建了新的Angular 2应用程序,如下所示: ng new PROJECT_NAME但是当我运行ng serve ,它会显示以下错误:

Error: Attempting to watch missing directory: typings ... Error: Attempting to watch missing directory: typings ...

broccoli plugin was instantiated at: .... broccoli plugin was instantiated at: ....

You should install typings package: npm install typings --global 你应该安装打字包: npm install typings --global

and than run following command: 而不是运行以下命令:

npm run postinstall

Postinstall is a process that needs to take place after npm installs all the required packages through. Postinstall是一个需要在npm安装所有必需的软件包之后进行的过程。 On some systems it does not take place. 在某些系统上它不会发生。 To force it to install run the following commands in the project directory: 要强制安装,请在项目目录中运行以下命令:

npm i -g typings npm i -g typings

npm run postinstall npm运行postinstall

After running these you can easily launch ng serve in the project directory 运行这些后,您可以轻松地在项目目录中启动ng服务

proxy issue maybe use create a file in your root folde 代理问题可能使用在您的根folde中创建一个文件

{
    proxy=http://ip-addres:port
    "rejectUnauthorized": false
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM