简体   繁体   English

AoT编译失败-没有这样的文件或目录,lstat'tsconfig-aot.json'

[英]AoT Compilation Failed - no such file or directory, lstat 'tsconfig-aot.json'

Using the Setup demo project and following the instructions here , I get the following error when running node_modules/.bin/ngc -p tsconfig-aot.json: 使用Setup演示项目并按照此处的说明进行操作,在运行node_modules / .bin / ngc -p tsconfig-aot.json时出现以下错误:

Error: ENOENT: no such file or directory, lstat 'tsconfig-aot.json'
    at Object.fs.lstatSync (fs.js:947:11)
    at Object.main (/Users/EL-C/quickstart/node_modules/@angular/tsc-wrapped/src/main.js:59:21)
    at main (/Users/EL-C/quickstart/node_modules/@angular/compiler-cli/src/main.js:19:16)
    at Object.<anonymous> (/Users/EL-C/quickstart/node_modules/@angular/compiler-cli/src/main.js:35:5)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module.runMain (module.js:609:10)
Compilation failed

I followed the instructions exactly and know the AoT file is there: 我完全按照说明进行操作,并且知道AoT文件在其中: tsconfig-aot文件结构

In case it's needed, here is the Package.json file: 万一需要,这里是Package.json文件:

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "build": "tsc -p src/",
    "build:watch": "tsc -p src/ -w",
    "build:e2e": "tsc -p e2e/",
    "serve": "lite-server -c=bs-config.json",
    "serve:e2e": "lite-server -c=bs-config.e2e.json",
    "prestart": "npm run build",
    "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
    "pree2e": "npm run build:e2e",
    "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
    "preprotractor": "webdriver-manager update",
    "protractor": "protractor protractor.config.js",
    "pretest": "npm run build",
    "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
    "pretest:once": "npm run build",
    "test:once": "karma start karma.conf.js --single-run",
    "lint": "tslint ./src/**/*.ts -t verbose"
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular/common": "~4.3.4",
    "@angular/compiler": "~4.3.4",
    "@angular/compiler-cli": "^4.4.6",
    "@angular/core": "~4.3.4",
    "@angular/forms": "~4.3.4",
    "@angular/http": "~4.3.4",
    "@angular/platform-browser": "~4.3.4",
    "@angular/platform-browser-dynamic": "~4.3.4",
    "@angular/platform-server": "^4.4.6",
    "@angular/router": "~4.3.4",
    "angular-in-memory-web-api": "~0.3.0",
    "core-js": "^2.4.1",
    "rxjs": "5.0.1",
    "systemjs": "0.19.40",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@types/jasmine": "2.5.36",
    "@types/node": "^6.0.46",
    "canonical-path": "0.0.2",
    "concurrently": "^3.2.0",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "lite-server": "^2.2.2",
    "lodash": "^4.16.4",
    "protractor": "^4.0.14",
    "rimraf": "^2.5.4",
    "tslint": "^3.15.1",
    "typescript": "~2.1.0"
  },
  "repository": {}
}

Why can't the ngc command find the file? ngc命令为什么找不到文件? Is this an issue with versioning? 这是版本问题吗? Is there a known bug? 有没有已知的错误? Google didn't reveal anything to me. Google没有向我透露任何信息。

tsconfig-aot.json的路径不正确,请改用以下命令:

node_modules/.bin/ngc -p ./src/app/tsconfig-aot.json

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM