我正在尝试让Jenkins在Cloudbees上构建并运行。我已经成功安装了NodeJ,并从BitBucket存储库中提取了源代码。我正在尝试运行我的grunt任务,以在部署之前最小化并连接我的JS和CSS文件。但是,即使已成功安装,我也无法运行grunt程序。以下是我的构建脚本:
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node NODE_VERSION=0.8.0 \ source ./use-node npm install npm install grunt grunt
我尝试安装带有和不带有-g选项的grunt都没有成功。这是我的构建的grunt部分的控制台输出:
+ npm install grunt ... npm http GET https://registry.npmjs.org/grunt npm http 200 https://registry.npmjs.org/grunt ... grunt@0.4.0 node_modules/grunt ├── dateformat@1.0.2-1.2.3 ├── colors@0.6.0-1 ├── hooker@0.2.3 ├── eventemitter2@0.4.11 ├── which@1.0.5 ├── iconv-lite@0.2.7 ├── coffee-script@1.3.3 ├── lodash@0.9.2 ├── nopt@1.0.10 (abbrev@1.0.4) ├── rimraf@2.0.3 (graceful-fs@1.1.14) ├── minimatch@0.2.11 (sigmund@1.0.0, lru-cache@2.2.2) ├── glob@3.1.21 (graceful-fs@1.2.0, inherits@1.0.0) ├── findup-sync@0.1.2 (lodash@1.0.1) └── js-yaml@1.0.3 (argparse@0.1.12) + grunt /tmp/hudson3382014549646667419.sh: line 8: grunt: command not found Build step 'Execute shell' marked build as failure Finished: FAILURE
关于如何使它工作的任何想法?在Cloudbees中甚至有可能吗?
现在,恼人的Grunt被分解为一个单独的cli模块。而且,令人讨厌的是,该cli模块本身并不包含grunt。
要使此工作:
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node NODE_VERSION=0.8.0 \ source ./use-node npm install npm install grunt npm install grunt-cli export PATH=$PATH:node_modules/grunt-cli/bin/ grunt
如果进行此更改的人改变了使其变得明智的方式,则将来可能会更改。
此处的文档:http : //gruntjs.com/getting- started