6

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

6 Answers 6

4

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"
Sign up to request clarification or add additional context in comments.

Comments

4

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.

1 Comment

you need to do "npm run build"
4

It worked for me.

image: node:10

pipelines:
  default:
    - step:
        script:
          - npm install
          - npm install -g @angular/cli
          - ng build --prod

Comments

1

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

Comments

0

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

Comments

-1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.