简体   繁体   English

无法从“/home/circleci/my-project”找到模块“@angular-devkit/build-angular”

[英]Could not find module "@angular-devkit/build-angular" from "/home/circleci/my-project"

I am trying to integrate simple Angular project with CircleCi.我正在尝试将简单的 Angular 项目与 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:当我运行 ng test 时,每个测试都通过了,该项目也可以与 ng serve 一起正常工作,但是当我将它推送到 GitHub CircleCi 时,它不会通过,因为:

#!/bin/bash -eo pipefail xvfb-run -a ng test --browsers=ChromeNoSandbox --code-coverage --watch=false #!/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".无法从“/home/circleci/my-project”找到模块“@angular-devkit/build-angular”。 Error: Could not find module "@angular-devkit/build-angular" from "/home/circleci/my-project".错误:无法从“/home/circleci/my-project”找到模块“@angular-devkit/build-angular”。

Here is config.yml file这是config.yml文件

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和量角器-ci.conf.js

const config = require('./protractor.conf').config;
config.capabilities = {
  browserName: 'chrome',
  chromeOptions: {
    args: ['--no-sandbox']
  }
};
exports.config = config;

package.json包.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 node.js 版本 = v10.10.0 npm 版本 = 6.4.1

Through your terminal cd to your project directory folder, then type通过您的终端cd到您的项目目录文件夹,然后键入

ionic repair

then follow the message info that will appear by answering the Continue?然后按照将出现的消息信息回答继续? Y if you accept/ N if not. Y 如果您接受 / N 如果不接受。 That did the job for me.那为我完成了工作。

I struggled with the same problem.我在同样的问题上挣扎。 My project was generated using the v1.6.0 of angular-cli.我的项目是使用 angular-cli 的 v1.6.0 生成的。

  1. npm update -g @angular/cli

  2. editing my package.json changing the line "@angular/cli": "1.6.0" , to "@angular/cli": "^1.6.0",编辑我的 package.json 将行"@angular/cli": "1.6.0"更改为"@angular/cli": "^1.6.0",

  3. npm update did the trick. npm update做到了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发生未处理的异常:找不到模块“@angular-devkit/build-angular”从“/project 到 docker - An unhandled exception occurred: Could not find module “@angular-devkit/build-angular” from "/project into a docker 找不到模块“@angular-devkit/build-angular” - Could not find module "@angular-devkit/build-angular" 找不到模块“@angular-devkit/build-angular” - Can not find module “@angular-devkit/build-angular” 使用 ng serve 时出现 Angular8 错误:找不到模块“@angular-devkit/build-angular” - Angular8 error when using ng serve: Could not find module “@angular-devkit/build-angular” 无法从“F:\\\\Angular Projects\\\\cmp-databinding-start”中找到模块“@angular-devkit/build-angular” - Could not find module "@angular-devkit/build-angular" from "F:\\Angular Projects\\cmp-databinding-start" 发生未处理的异常:找不到模块“@angular-devkit/build-angular” - An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" npm 安装后找不到模块“@angular-devkit/build-angular” - Could not find module "@angular-devkit/build-angular" after npm install 无法使用ng服务找到模块“@ angular-devkit / build-angular” - Could not find module “@angular-devkit/build-angular” with ng serve ng serve :找不到模块“@angular-devkit/build-angular” - ng serve : Could not find module "@angular-devkit/build-angular" 发生未处理的异常:无法从“/ang-frontend”找到模块“@angular-devkit/build-angular”。 使用 docker 和 docker-compose - An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" from "/ang-frontend". with docker and docker-compose
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM