Reputation: 1324
I am trying to integrate simple Angular project with CircleCi. When I run ng test, every test is passing, the project is also working fine with ng serve but when I push it to the GitHub CircleCi won't pass it because of:
#!/bin/bash -eo pipefail xvfb-run -a ng test --browsers=ChromeNoSandbox --code-coverage --watch=false
Could not find module "@angular-devkit/build-angular" from "/home/circleci/my-project". Error: Could not find module "@angular-devkit/build-angular" from "/home/circleci/my-project".
Here is config.yml file
version: 2
jobs:
build:
working_directory: ~/my-project
docker:
- image: circleci/node:10.10.0-browsers
steps:
- checkout
- restore_cache:
key: AngularCircleCI-{{ .Branch }}-{{ checksum "package.json" }}
- run: sudo npm install -g @angular/cli
- save_cache:
key: AngularCircleCI-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- "node_modules"
- run: xvfb-run -a ng test --browsers=ChromeNoSandbox --code-coverage --watch=false
- run: xvfb-run -a npm run e2e --protractor-config=protractor-ci.conf.js
And protractor-ci.conf.js
const config = require('./protractor.conf').config;
config.capabilities = {
browserName: 'chrome',
chromeOptions: {
args: ['--no-sandbox']
}
};
exports.config = config;
package.json
{
"name": "grades-app-front",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.2.5",
"@angular/cdk": "^7.3.2",
"@angular/common": "^7.2.5",
"@angular/compiler": "^7.2.5",
"@angular/core": "^7.2.5",
"@angular/flex-layout": "^7.0.0-beta.23",
"@angular/forms": "^7.2.5",
"@angular/material": "7.3.0",
"@angular/platform-browser": "^7.2.5",
"@angular/platform-browser-dynamic": "^7.2.5",
"@angular/router": "^7.2.5",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-free": "^5.7.2",
"@ngrx/effects": "^7.2.0",
"@ngrx/store": "^7.2.0",
"@ngrx/store-devtools": "^7.2.0",
"angular-font-awesome": "^3.1.2",
"bootstrap": "^4.3.1",
"core-js": "^2.6.5",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"rxjs": "~6.3.3",
"rxjs-compat": "^6.4.0",
"tslib": "^1.9.0",
"zone.js": "^0.8.29"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.12.4",
"@angular/cli": "^7.2.4",
"@angular/compiler-cli": "^7.2.5",
"@angular/language-service": "^7.2.5",
"@types/core-js": "^2.5.0",
"@types/jasmine": "^2.8.16",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
}
}
node.js version = v10.10.0 npm version = 6.4.1
Upvotes: 1
Views: 1359
Reputation: 21
Through your terminal cd
to your project directory folder, then type
ionic repair
then follow the message info that will appear by answering the Continue? Y if you accept/ N if not. That did the job for me.
Upvotes: 1
Reputation: 10531
I struggled with the same problem. My project was generated using the v1.6.0 of angular-cli.
npm update -g @angular/cli
editing my package.json changing the line "@angular/cli": "1.6.0"
,
to "@angular/cli": "^1.6.0",
npm update
did the trick.
Upvotes: 0