[angular-cli] 오류 : 로컬 작업 공간 파일 ( ‘angular.json’)을 찾을 수 없습니다

나는 한 travis-ci내 GitHub의 계정 (통합 https://github.com/pradeep0601/Angular5-Router-App ).

내가 업데이트했을 때 @angular/cli1.7.4에서 6.0.0-rc.3으로 버전을 하면 빌드가 오류와 함께 실패했습니다.

Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
    at WorkspaceLoader._getProjectWorkspaceFilePath (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/workspace-loader.js:37:19)
    at WorkspaceLoader.loadWorkspace (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/workspace-loader.js:24:21)
    at TestCommand._loadWorkspaceAndArchitect (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:177:32)
    at TestCommand.<anonymous> (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:45:25)
    at Generator.next (<anonymous>)
    at /home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:3:12)
    at TestCommand.initialize (/home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/architect-command.js:44:16)
    at /home/travis/build/pradeep0601/Angular5-Router-App/node_modules/@angular/cli/models/command-runner.js:100:23

실행 환경을 더 잘 이해하기위한 package.json 스 니펫 :

    "@angular/cli": "6.0.0-rc.3",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",



답변

방금 같은 문제가있었습니다.

릴리스 v6.0.0-rc.2, https://github.com/angular/angular-cli/releases 와 관련이 있습니다 .

새로운 구성 형식. 새 파일은 angular.json에서 찾을 수 있습니다 (그러나 .angular.json도 허용됨). CLI 1.7 프로젝트에서 ng update를 실행하면 새 구성으로 이동합니다.

나는 실행해야했다.

ng update @angular/cli --migrate-only --from=1.7.4

이 제거 .angular-cli.json및 생성되었습니다 angular.json.

이것이 1.7.4를 사용하여 프로젝트로 연결되면 v6을 로컬로 설치하십시오.

npm install --save-dev @angular/cli@v6.0.0-rc.4

다음으로 프로젝트를 다시 업데이트하십시오.

ng update @angular/cli --migrate-only --from=1.7.4


답변

같은 오류 메시지가 나타납니다. 그것은 결국 어리석은 실수였습니다 ng serve. Angular 프로젝트가있는 디렉토리에서 실행되지 않았습니다 . 이 명령을 실행하기 전에 올바른 디렉토리 (프로젝트 디렉토리)에 있는지 확인하십시오.


답변

최신 버전없이 --migrate-only repo가 ​​업데이트 않았습니다.

내가 했어 업데이트했다

Angular CLI 구성 형식이 변경되었으며 다음 명령을 실행하여 기존 구성을 자동으로 업데이트 할 수 있습니다.

ng update @angular/cli
            Updating karma configuration
            Updating configuration
            Removing old config file (.angular-cli.json)
            Writing config file (angular.json)
            Some configuration options have been changed, please make sure to update any npm scripts which you may have modified.
DELETE .angular-cli.json
CREATE angular.json (3684 bytes)
UPDATE karma.conf.js (1040 bytes)
UPDATE src/tsconfig.spec.json (322 bytes)
UPDATE package.json (1340 bytes)
UPDATE tslint.json (3140 bytes)


답변

글쎄, 내 angular cli버전을 업데이트하자마자 같은 문제에 직면했다 .

이전에는 1.7.4를 사용하고 있었고 지금은로 업그레이드했습니다 angular cli 6.0.8.

Angular Cli 글로벌을 업데이트하려면 :

npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest

Angular Cli dev를 업데이트하려면 :

npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install

npm 설치 후 감사 문제를 해결하려면

npm audit fix

“angular.json”과 관련된 문제를 해결하려면 :

ng update @angular/cli --migrate-only --from=1.7.4


답변

Angular cli의 이전 버전을 설치 제거하고 Angular CLI 전역을 설치하십시오.

Angular cli 글로벌 패키지를 다음 버전 인 “@ angular / compiler-cli”로 업데이트하십시오 : “^ 6.0.0”

npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@next

다음 명령을 실행하여 새 프로젝트 및 기본 애플리케이션을 생성하십시오.

ng new my-project
cd my-project
ng serve


답변

아래 명령을 사용해보십시오.

ng update @angular/cli --migrate-only --from=1.7.4

아래를 수행합니다

  • 카르마 구성 업데이트

  • 구성 업데이트

  • 이전 구성 파일 (.angular-cli.json) 제거

  • 구성 파일 작성 (angular.json)

위의 명령은 파일이있는 폴더에서 실행해야합니다. angular-cli.json그런 다음로 바뀝니다 angular.json.


답변

당신이 버전을 모르는 경우, 현재 프로젝트가 만들어졌습니다, 당신은 --from명령 을 생략 하고 입력 할 수 있습니다--migrate-only

ng update @ angular / cli-마이그레이션 전용