Jenkins jasmine-node command not found

别等时光非礼了梦想. 提交于 2020-01-06 11:34:28

问题


I am trying to configure Jenkins to be used for my team which works on node.js projects. We used jasmine-node for most of our projects.

I have a jenkins instance managed by another group in the org which recognizes node and npm.

I ran 'npm install -g jasmine-node' as one of the Jenkins job and the coonsole output says it is successfull:

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

But when i run the jasmine tests in Jenkins shell for the job with the command 'jasmine-node .' then the jenkins server says that jasmine-node command is not found as shown below:

    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

I am not sure how to install jasmine-node on the jenkins box.

Do i have to add the jasmine-node to PATH for this to work? If yes, how do i do so?

please advise,

thanks


回答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



来源:https://stackoverflow.com/questions/33784211/jenkins-jasmine-node-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!