Angular-cli项目跨平台构build问题

我在Mac上创build了实验性的angular-cli项目。 比我已经把它移到Ubuntu和不能build立:

 $ 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上完美运行。

Env细节

 $ npm -v 4.0.5 $ node -v v7.4.0 $ ng -v Angular CLI: 1.5.5 Node: 7.4.0 OS: linux x64 Angular: 5.0.5 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router @angular/cdk: 5.0.0-rc0 @angular/cli: 1.5.5 @angular/material: 5.0.0-rc0 @angular-devkit/build-optimizer: 0.0.34 @angular-devkit/core: 0.0.22 @angular-devkit/schematics: 0.0.39 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.8.5 @schematics/angular: 0.1.9 typescript: 2.4.2 webpack: 3.8.1 

我发现也回答npm警告NOTSUP SKIPPING可选的依赖:fsevents@1.0.14不支持的平台它部分描述的消息,但它并没有帮助我与我的项目运行。 (它不能以任何方式启动)。

为了使我的项目可以在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"})