Ng: command not found (angular-cli & yarn)

I don’t think this has to do with yarn. I am a bit confused on how this ever worked.

ng test assumes that ng is installed globally. Otherwise you would need to to execute the absolute command node_modules/angular-cli/bin/ng unless you are calling it as a part of a script from package.json.

Could you share your circle.yml from when you were doing this without yarn?

Ultimately there are two options (as far as I know)

  1. Install angular-cli globally npm install -g angular-cli so that you can call ng from any context
  2. Make a script in package.json such as:
{
  "scripts": {
    "test": "ng test --watch=false"
  }

and then execute it with

test:
  override:
    - npm run test

Update

I ran a build using just npm and it totally works just like you said.

Update 2

I see whats is going on here. The reason why “plain” npm just works is because our inference engine is exporting node_modules as a part of the build dependency step. When you run override it no longer runs this step so then the node_modules dependencies are no longer in the PATH.

So the way to get this to work would be:

  1. Add node_modules/.bin to the PATH
  2. Make a script in package.json
  3. Install angular-cli globally
1 Like