Node.js Angular cli项目跨平台构建问题

Node.js Angular cli项目跨平台构建问题,node.js,ubuntu,npm,angular-cli,Node.js,Ubuntu,Npm,Angular Cli,我在Mac上创建了实验性的angularcli项目。然后我把它移到ubuntu上,无法构建: $ npm install npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevent

我在Mac上创建了实验性的
angularcli
项目。然后我把它移到ubuntu上,无法构建:

$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
&第一步:

$ ng serve
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
    at Class.run (/project-path/node_modules/@angular/cli/tasks/serve.js:51:63)
    at check_port_1.checkPort.then.port (/project-path/node_modules/@angular/cli/commands/serve.js:123:26)
    at process._tickCallback (internal/process/next_tick.js:103:7)
我很困惑,因为它在Mac上运行得非常好

环境详情
我还发现,答案部分描述了信息,但对我的项目运行没有帮助。(它无法以任何方式启动)。

要使我的项目在Ubuntu上运行,我需要在Mac上丢失一个文件(似乎Mac不需要).angular cli.json:

{
  "name": "angular4-in60-minutes",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.0.1",
    "@angular/cdk": "^5.0.0-rc0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/material": "^5.0.0-rc0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "bootstrap": "^3.2.1",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "jquery": "^3.2.1",
    "popper.js": "^1.12.9",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.5.0",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/language-service": "^5.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.4.2"
  }
}
添加此文件后,我的项目可以正确启动。但不管怎样,还是要注意警告

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

您在此处发布的文件内容不是angular-cli.json文件,而是package.json文件。您收到的警告是因为您的计算机在非Mac操作系统上,可以安全地忽略。它也发生在Windows上。当这个答案像这样不正确时,它没有很好的价值。对不起,文件名中缺少点,已修复。文件名为.angular-cli.json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})