2016-07-05 43 views
3

嘗試使用Angular CLI設置管道並在調用ng build時遇到問題。Atlassian Pipelines和Angular CLI

pipelines: 
    default: 
    - step: 
     script: # Modify the commands below to build your repository. 
      - npm --version 
      - npm install 
      - ng build 

angular-cli是我的package.json中的一個dev依賴項,但是ng找不到。

bash: ng: command not found 

我錯過了什麼步驟或做錯了什麼? 謝謝你

回答

3

看起來像它必須從npm上下文中調用。我最終打電話給npm build並在package中添加腳本.json

"build": "ng build" 
0

你必須在npm環境中調用就像上面提出的那樣。在你的package.json編寫一個腳本:

"scripts": { 
     "build": "ng build" 
} 

那麼你可以有

pipelines: 
    default: 
    - step: 
     script: # Modify the commands below to build your repository. 
      - npm --version 
      - npm install 
      - npm build 

將運行ng build

2

包括npm build如上述建議後,事情似乎要順利運行,但它確實其實沒有做任何事情。爲了工作,我不得不用$(npm bin)/ng build來替換它。

0

Angular CLI未安裝在您的泊塢窗圖像中。

使用此配置:

image: trion/ng-cli # Any docker image from dokerhub with angular cli installed. 

pipelines: 
    default: 
    - step: 
     caches: 
      - node 
     script: # Modify the commands below to build your repository. 
      - npm install 
      - npm run build