Jenkins jasmine-node 命令未找到 (Jenkins jasmine-node command not found)


問題描述

Jenkins jasmine‑node 命令未找到 (Jenkins jasmine‑node command not found)

我正在嘗試將 Jenkins 配置為用於我的團隊,該團隊在 node.js 項目上工作。我們在大多數項目中都使用了 jasmine‑node。

我有一個 jenkins 實例,由組織中的另一個組管理,它可以識別 node 和 npm。

我將 'npm install ‑g jasmine‑node' 作為 Jenkins 作業之一運行,並且控制台輸出顯示它是成功的:

Building on master in workspace C:\.jenkins\workspace\ttm‑closr
> git rev‑parse ‑‑is‑inside‑work‑tree
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.cerner.com/ApplicationServices/ttm‑closr.git
Fetching upstream changes from https://github.cerner.com/ApplicationServices/ttm‑closr.git
> git ‑‑version
using .gitcredentials to set credentials
> git config ‑‑local credential.helper store ‑‑file=\"C:\Temp\git2392678818489855660.credentials\"
> git fetch ‑‑tags ‑‑progress https://github.cerner.com/ApplicationServices/ttm‑closr.git +refs/heads/*:refs/remotes/origin/*
> git config ‑‑local ‑‑remove‑section credential
> git rev‑parse "origin/master^{commit}"
Checking out Revision 2b8831b19eb22f5d38652ab0b2dd230e2e5cf5d8 (origin/master)
> git config core.sparsecheckout
> git checkout ‑f 2b8831b19eb22f5d38652ab0b2dd230e2e5cf5d8
> git rev‑list 2b8831b19eb22f5d38652ab0b2dd230e2e5cf5d8
[ttm‑closr] $ sh ‑xe C:\Temp\hudson1199475728575930889.sh
+ npm install ‑g jasmine‑node
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\jasmine‑node ‑> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\jasmine‑node\bin\jasmine‑node
jasmine‑node@1.14.5 C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\jasmine‑node
├── mkdirp@0.3.5
├── underscore@1.8.3
├── walkdir@0.0.11
├── coffee‑script@1.10.0
├── jasmine‑growl‑reporter@0.0.3 (growl@1.7.0)
├── requirejs@2.1.20
├── jasmine‑reporters@1.0.2
└── gaze@0.3.4 (minimatch@0.2.14, fileset@0.1.8)
Sending e‑mails to: snehil.wakchaure1@cerner.com
Finished: SUCCESS

但是當我在 Jenkins 中運行 jasmine 測試時使用命令 'jasmine‑node ' 執行作業的 shell。然後 jenkins 服務器說找不到 jasmine‑node 命令,如下所示:

    Building on master in workspace C:\.jenkins\workspace\ttm‑closr
> git rev‑parse ‑‑is‑inside‑work‑tree
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.cerner.com/ApplicationServices/ttm‑closr.git
Fetching upstream changes from https://github.cerner.com/ApplicationServices/ttm‑closr.git
> git ‑‑version
using .gitcredentials to set credentials
> git config ‑‑local credential.helper store ‑‑file=\"C:\Temp\git7724050299130064334.credentials\"
> git fetch ‑‑tags ‑‑progress https://github.cerner.com/ApplicationServices/ttm‑closr.git +refs/heads/*:refs/remotes/origin/*
> git config ‑‑local ‑‑remove‑section credential
> git rev‑parse "origin/master^{commit}"
Checking out Revision 2b8831b19eb22f5d38652ab0b2dd230e2e5cf5d8 (origin/master)
> git config core.sparsecheckout
> git checkout ‑f 2b8831b19eb22f5d38652ab0b2dd230e2e5cf5d8
> git rev‑list 2b8831b19eb22f5d38652ab0b2dd230e2e5cf5d8
[ttm‑closr] $ sh ‑xe C:\Temp\hudson2835855030225455242.sh
+ jasmine‑node .
C:\Temp\hudson2835855030225455242.sh: line 2: jasmine‑node: command not found
Build step 'Execute shell' marked build as failure
Sending e‑mails to: snehil.wakchaure1@cerner.com
[BFA] Scanning build for known causes...

[BFA] Done. 0s
Finished: FAILURE

我不知道如何在 jenkins 盒子上安裝 jasmine‑node。

我是否必須將 jasmine‑node 添加到 PATH 才能正常工作?如果是,我該怎麼做?

請指教,<


參考解法

方法 1:

I think you have to add the npm binary to your path. Find the location of your npm global binaries: npm config get prefix. It's probably something like C:\Users\username\AppData\Roaming\npm

Go to "Global Properties ‑> Environment Variables" and add PATH, with value: $PATH:/C:/Users/username/AppData/Roaming/npm

(by Rookielvthillo)

參考文件

  1. Jenkins jasmine‑node command not found (CC BY‑SA 2.5/3.0/4.0)

#jenkins-plugins #jenkins #jasmine-node #node.js #jenkins-cli






相關問題

Email-ext Pre 腳本使用 (Email-ext Pre script usage)

分佈式 Jenkins - Linux 上的主控和 Windows 上的從屬 - 如何配置節點特定設置 (Distributed Jenkins- Master on Linux and slave on windows- How to configure node specific setting)

Jenkins插件開發不適用於maven 2 (Jenkins plugin development not working with maven 2)

Jenkins 全天運行構建和測試 (Jenkins running builds and tests all day long)

Jenkins jasmine-node 命令未找到 (Jenkins jasmine-node command not found)

在 jenkins 中更新 SVN 憑據 (Update SVN credentials in jenkins)

Jenkins 構建錯誤 - MSBUILD:錯誤 MSB1009:項目文件不存在 (Jenkins Build Error - MSBUILD : error MSB1009: Project file does not exist)

在初始分支創建時,jenkins 服務器中未配置 jenkinsfile 參數屬性 (jenkinsfile parameter properties not configured in jenkins server at initial branch creation)

如何將 Active Choices 反應參數傳遞給 Scriptler (How to Pass Active Choices Reactive Parameters to Scriptler)

配置通過 Dockerfile 安裝的 Jenkins 插件 (Configuring Jenkins plugin installed via Dockerfile)

使用觸發構建的用戶從 Jenkins 運行批處理作業 (Run a batch job from Jenkins with the user who triggered the build)

電子郵件擴展插件未加載通過配置文件提供程序插件添加的 groovy 模板 (Email Extension Plugin is not loading groovy template added via Config File Provider Plugin)







留言討論