Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
bash:ngc:未找到命令_Bash_Angular - Fatal编程技术网

bash:ngc:未找到命令

bash:ngc:未找到命令,bash,angular,Bash,Angular,我正在使用@angular/compiler cli以aot模式构建我的ng2应用程序。当我在bash窗口中输入'ngc-ptconfig aot.json'时,我得到'bash:ngc:command not found'。但是,当我使用'node_modules/.bin/ngc-p tsconfig aot.json'时,它就可以工作了。我在谷歌上搜索了好几次,但没有得到任何完整的信息。有人能帮我一下吗?谢谢 看来你需要把ngc放在你的道路上: echo $PATH 在您的路径中是否看到

我正在使用@angular/compiler cli以aot模式构建我的ng2应用程序。当我在bash窗口中输入'ngc-ptconfig aot.json'时,我得到'bash:ngc:command not found'。但是,当我使用'node_modules/.bin/ngc-p tsconfig aot.json'时,它就可以工作了。我在谷歌上搜索了好几次,但没有得到任何完整的信息。有人能帮我一下吗?谢谢

看来你需要把ngc放在你的道路上:

echo $PATH
在您的路径中是否看到二进制ngc

如果没有:

PATH=$PATH:/path/to/ngc
要使其永久化,请将其添加到.bash\u配置文件

export PATH=$PATH:/path/to/ngc

如果不想全局设置,可以在角度项目中指定绝对路径,只要确保在不再使用该路径时删除该部分路径即可

ngc位于node_modules/.bin中,因此根据您希望使用ngc的位置,您可以如下导出路径:

PATH=$PATH:../../../node_modules/.bin

我尝试在windows上将斜杠改为“反斜杠”,这对我很有效:

node_modules\\.bin\ngc

我的节点版本是5.0.0,npm版本是3.3.6。我在$PATH中没有找到它,我将添加它。Thxso ngc的路径是什么?@conversorshaki取决于安装,但您可以在linux上使用以下命令找到任何内容:
find/-name ngc
,如果我在我的项目目录中,并运行
npm install@angular/cli
我将在哪里找到ngc?我使用angular 6,并且我发现在按照中所述安装模块之后,文件tsconfig-aot.json不存在;但是,名为tsconfig.json的文件没有。因此,我运行了以下命令以使其工作。我不确定它是否正确:
node\u modules/.bin/ngc-p tsconfig.json