2017-09-04 47 views
0

Angular cliでプロジェクトを作成しました。私は円を使ってCIをしたいです。プロジェクトはBitbucketにアップロードされ、Circle CIによって正しく選択されます。ビルドは失敗します。続いては、私はangularcli以前で作成されたpackage.jsonがAngularCLIをインストールすることを前提としています。)CircleCIのsample.ymlを拾い、それを変更(追加NGテスト(config.ymlである。npmのインストールでcircle ci(angular cliプロジェクト)が失敗する

version: 2 
jobs: 
    build: 
    #working_directory: ~/mern-starter 
    # The primary container is an instance of the first list image listed. Your build commands run in this container. 
    docker: 
     - image: circleci/node:7.10.0 
    # The secondary container is an instance of the second listed image which is run in a common network where ports exposed on the primary container are available on localhost. 
     #- image: mongo:3.4.4 
    steps: 
     - checkout 
     - run: 
      name: Update npm 
      command: 'sudo npm install -g [email protected]' 
     - restore_cache: 
      key: dependency-cache-{{ checksum "package.json" }} 
     - run: 
      name: Install npm wee 
      command: npm install 
     - save_cache: 
      key: dependency-cache-{{ checksum "package.json" }} 
      paths: 
      - node_modules 
    test: 
    docker: 
     - image: circleci/node:7.10.0 
     #- image: mongo:3.4.4 
    steps: 
     - checkout 
     - run: 
      name: Test 
      command: ng test 
     #- run: 
     # name: Generate code coverage 
     # command: './node_modules/.bin/nyc report --reporter=text-lcov' 
     #- store_artifacts: 
     # path: test-results.xml 
     # prefix: tests 
     #- store_artifacts: 
     # path: coverage 
     # prefix: coverage 

workflows: 
    version: 2 
    build_and_test: 
    jobs: 
     - build 
     - test: 
      requires: 
      - build 
      filters: 
      branches: 
       only: dev 

エラー

#!/bin/bash -eo pipefail 
npm install 
module.js:472 
    throw err; 
    ^

Error: Cannot find module 'process-nextick-args' 
    at Function.Module._resolveFilename (module.js:470:15) 
    at Function.Module._load (module.js:418:25) 
    at Module.require (module.js:498:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23) 
    at Module._compile (mod 

は、私がすでにインストールされているプロセスnexttick-引数を想定のでnpm install工程の後に次の行を参照してください。 [email protected] node_modules/npm/node_modules/npm-registry-client/node_modules/concat-stream/node_modules/readable-stream/node_modules/process-nextick-arg

答えて

0

configuratに続いてイオンは私のために働いた。 CircleCI 2.0を使用しました。私はまだそれを洗練しており、将来答えを変えるかもしれない。上記のスクリプトに加え

version: 2 

jobs: 
    build: 
     working_directory: ~/angularcli 
     # The primary container is an instance of the first list image listed. Your build commands run in this container. 
     docker: 
      - image: circleci/node:6-browsers 
       environment: 
        CHROME_BIN: "/usr/bin/google-chrome" 
     steps: 
      - checkout 
      - run: 
       name: Install node_modules with npm 
       command: npm install 
      - save_cache: 
       key: dependency-cache-{{ checksum "package.json" }} 
       paths: 
        - ./node_modules 
      - run: 
       name: Install angularcli 
       command: sudo npm install -g @angular/[email protected] 
      - run: 
       name: Run unit tests with karma 
       command: ng test 
      - store_test_results: 
       path: test-results.xml 

カルマすべてのテストケースを実行した後に出るように、karma.conf.js singleRun: true trueにsingleRunフラグを設定します。このフラグがなければ、Karmaは連続モードで動作し、ng testストップは終了せず、タイムアウト後にテストが失敗します。

関連する問題