我需要运行以下命令:
bower update
grunt build
我收到以下错误:
C:\Program Files (x86)\Jenkins\jobs\Build\workspace>export PHANTOMJS_BIN=/usr/lib/node_modules/phantomjs
'export' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\Build\workspace>export XDG_CONFIG_HOME="$WORKSPACE/.config"
'export' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\Build\workspace>bower update
'bower' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\Build\workspace>grunt build
'grunt' is not recognized as an internal or external command,
operable program or batch file.
请建议
答案 0 :(得分:4)
export
命令不适用于Windows;它适用于* nix机器。如果要在Windows操作系统上设置某个路径,请使用set
命令。请记住,此值仅适用于当前shell 。关闭命令提示符后,该值也将被取消设置。
例如,
set PHANTOMJS_BIN=/usr/lib/node_modules/phantomjs
set XDG_CONFIG_HOME="$WORKSPACE/.config"
对于第三个和第四个错误,您必须确保bower
(和grunt
)命令在PATH中,否则系统将永远无法找到正在发生的命令。要使其工作,只需将路径添加到PATH
变量中的bower可执行文件。
set PATH=%PATH%;path_to_bower_executable
例如,如果bower命令位于c:\ bower \ bin中,则只需添加
set PATH=%PATH%;C:\bower\bin
要永久设置更改,您可以执行this链接中提到的步骤。
答案 1 :(得分:2)
问题解决了。这就是我现在正在做的事情。
set PATH=PATH=C:\Windows\system32;C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Java\jre7\bin;
C:\Program Files\nodejs\;
C:\Ruby200\bin;
C:\Program Files (x86)\Git\bin;
C:\Ruby200-x64\bin;
C:\Users\appcito\AppData\Roaming\npm
cd testnew
cd ui
call npm cache clear
call npm install
call bower cache clear
call bower install
call grunt build