Reputation: 8288
Trying to set up pipelines with Angular CLI and running into an issue when calling ng build
.
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- npm --version
- npm install
- ng build
angular-cli is a dev dependency in my package.json, but ng cannot be found.
bash: ng: command not found
What step did I miss or doing wrong? Thank-you
Upvotes: 6
Views: 3456
Reputation: 1
You can use this too:
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- npm --version
- npm install
- npm run ng build
Upvotes: 0
Reputation: 41
It worked for me.
image: node:10
pipelines:
default:
- step:
script:
- npm install
- npm install -g @angular/cli
- ng build --prod
Upvotes: 4
Reputation: 628
Angular CLI is not installed in your docker image.
Use this configuration:
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
Upvotes: -1
Reputation: 41
After including npm build
as suggested above, things seemed to run successfully but it did actually not do anything. I had to replace it with $(npm bin)/ng build
in order to work.
Upvotes: 4
Reputation: 11
You have to call in the npm context Just like suggested above. In your package.json write a script:
"scripts": {
"build": "ng build"
}
then you can have
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- npm --version
- npm install
- npm build
which will run ng build
Upvotes: 1
Reputation: 8288
Looks like it had to be called from npm context. I ended up calling npm build and added the script for it in the package.json
"build": "ng build"
Upvotes: 4