Gitlab CI节点模块命令

时间:2017-10-05 10:26:57

标签: batch-file npm gitlab-ci gitlab-ci-runner

我有一个在Windows机器上运行的CI配置。我的.gitlab-ci.yml文件看起来像:

stages:
  - package

package:
  stage: package

  tags:
    - xxx-installer

  only:
    - master

  script:
    - Package.cmd

  artifacts:
    paths:
      - Extensions/

脚本Package.cmd看起来像:

@echo off    
echo -------------------------
echo Packaging Extension
echo -------------------------

call npm install web-ext --global

call web-ext build -s "App/" -a "Extensions/" -o true

模块web-ext已成功安装,但在执行web-ext命令时,我的管道日志中出现以下错误:

  

'web-ext'不被识别为内部或外部命令,可操作程序或批处理文件。

但是,如果我在同一台机器上从终端执行Package.cmd,它就可以正常工作。

那么,是否需要做任何事情以便CI运行器识别节点模块命令?

更新
根据@SteveFest的建议,我检查了%path%变量位置,并在其中找到了C:\Users\prerak\AppData\Roaming\npm。但是,当它执行CI脚本时,它会在安装npm包之后输出以下输出:

C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\web-ext -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\web-ext\bin\web-ext
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm
`-- web-ext@2.0.0 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\web-ext\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
'web-ext' is not recognized as an internal or external command,
operable program or batch file.

所以我想,由于CI脚本没有在我的用户会话中运行,它正在C:\Windows\System32\config\systemprofile\AppData\Roaming\npmC:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\web-ext\bin\web-ext位置安装模块。所以我在PATH变量中添加了这两个路径,但结果仍然相同。

如果这是相关的,这是一个Firefox网络扩展项目,我正在尝试打包扩展程序。

0 个答案:

没有答案
相关问题