bash: line 1: ng: command not found
ng test --watch=false returned exit code 127
angular-cli is listed as a devDependency in the package.json, so the yarn command itself should install it, just as the npm install did with npm, right?
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/ngunless 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)
Install angular-cli globally npm install -g angular-cli so that you can call ng from any context
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.
Oh, you are right! I think the first approach ( making a script in package.json) would be a better approach, because if I have to install globally angular-cli with every build I’ll lose like 30-60 seconds.
Do you know if pre-installing Yarn in machines is on the roadmap of CircleCi?
Yes for sure, I am working with the build image team to get this done in the next image update.
Please keep in mind though that having it pre-installed will not address this specific issue. We would need to update our inference engine to handle yarn in order to make this completely automated.