Bluemix构建管道设置节点和npm版本 [英] Bluemix build pipeline set node and npm version

查看:273
本文介绍了Bluemix构建管道设置节点和npm版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在bluemix上部署一个angular 2应用程序.该代码位于github上,我想在推送内容时部署我的应用程序.所以我创建了一条管道. 首先是构建管道:要构建angular应用程序,我需要angularCLI,所以我想安装它.不幸的是,默认节点版本为4.2,但cli至少需要6.9. 这是我的build-shell-command:

I want to deploy an angular 2 app on bluemix. The code is located at github and i want to deploy my app when i push something. So i created a pipeline. First the build pipeline: to build the angular app i need angularCLI, so i want to install it. Unfortunately the default node version is 4.2 but the cli needs at least 6.9. Here is my build-shell-command:

#!/bin/bash
# The default Node.js version is 0.10.40
# To use Node.js 0.12.7, uncomment the following line:
#export PATH=/opt/IBM/node-v0.12/bin:$PATH
# To use Node.js 4.2.2, uncomment the following line:
export PATH=/opt/IBM/node-v6.9/bin:$PATH
npm install -g @angular/cli
npm run build

我试图用6.9替换4.2,但是它不起作用,它使用默认的节点版本0.10.40.有人知道如何设置节点版本吗? NPM版本也已过时...我该如何解决?

I tried to replace 4.2 with 6.9 but it doesnt work and it uses the default node version 0.10.40. Anyone know how to set the node version? Also the npm version is out of date... how can i fix this?

推荐答案

好,bluemix仅提供了node和npm的几个版本. 在 http://gh-blog.mybluemix.net/blogs/cokeSchlumpf/rethink-it/posts/bluemix/node-buildpipeline.md?cm_mc_uid=01575932457714863658655&cm_mc_sid_50200000=1487233177

Ok, bluemix just provide a few versions of node and npm... Found the solution at http://gh-blog.mybluemix.net/blogs/cokeSchlumpf/rethink-it/posts/bluemix/node-buildpipeline.md?cm_mc_uid=01575932457714863658655&cm_mc_sid_50200000=1487233177

#!/bin/bash
export NVM_DIR=/home/pipeline/nvm
export NODE_VERSION=5.10.1
export NVM_VERSION=0.29.0

npm config delete prefix \
  && curl https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}/install.sh | sh \
  && . $NVM_DIR/nvm.sh \
  && nvm install $NODE_VERSION \
  && nvm alias default $NODE_VERSION \
  && nvm use default \
  && node -v \
  && npm -v

npm install
# Further steps ...

这篇关于Bluemix构建管道设置节点和npm版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆