简体   繁体   English

“ ng build –env = prod”命令不起作用

[英]“ng build –env=prod” command not working

I've been given a JavaScript website and need to rebuild it to incorporate changes I've made to it. 我得到了一个JavaScript网站,需要重建它以合并我对其所做的更改。

I was told to run the following command from the source files directory in order to build the application: 有人告诉我从源文件目录运行以下命令以构建应用程序:

ng build –env=prod

but I'm getting the following error: 但出现以下错误:

You have to be inside an angular-cli project in order to use the build command. 您必须在angular-cli项目中才能使用构建命令。

I have angular-cli 0.1.0, node 4.2.2 and npm 2.14.7 installed, and am on Windows using Git Bash, if any of that helps. 我安装了angular-cli 0.1.0,节点4.2.2和npm 2.14.7,并且在Windows上使用Git Bash,如果有帮助的话。

If anyone has any ideas about why this is happening that would be much appreciated. 如果有人对为什么会这样有任何想法,将不胜感激。

First make sure, you are in project directory which you are building for production. 首先确保您在要生产的项目目录中。 If not got to dir by cd PROJECT_DIR 如果没有通过cd PROJECT_DIR进入目录

once you are in directory, try ng build --prod its equivalent to what you are using or try ng build --target=production --environment=prod 进入目录后,尝试ng build --prod与您正在使用的等效,或尝试ng build --target=production --environment=prod

Hope this helps. 希望这可以帮助。

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

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