我在此问题上苦苦挣扎,面临以下错误,无法找出原因。使用相同的package.json,我可以在macbook上运行我的应用程序,但是当我尝试使用npm start --prod
在Ubuntu上为AWS ec2实例上的Production安装/部署相同的应用程序时。我正面临以下错误。
环境详细信息如下。 Ubuntu版本:-18.04 LTS(GNU / Linux 4.15.0-1007-aws x86_64) NPM -v:-6.4.1 NODE -v:-v10.10.0
错误:-
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.4.1
3 info using node@v10.10.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle myPleaks@0.0.0prestart: myPleaks@0.0.0
6 info lifecycle myPleaks@0.0.0start: myPleaks@0.0.0
7 verbose lifecycle myPleaks@0.0.0start: unsafe-perm in lifecycle true
8 verbose lifecycle myPleaks@0.0.0start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ubuntu/mypleaks-ui/myPleaks/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle myPleaks@0.0.0start: CWD: /home/ubuntu/mypleaks-ui/myPleaks
10 silly lifecycle myPleaks@0.0.0start: Args: [ '-c', 'ng serve' ]
11 silly lifecycle myPleaks@0.0.0start: Returned: code: 137 signal: null
12 info lifecycle myPleaks@0.0.0start: Failed to exec start script
13 verbose stack Error: myPleaks@0.0.0 start: ng serve
13 verbose stack Exit status 137
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid myPleaks@0.0.0
15 verbose cwd /home/ubuntu/mypleaks-ui/myPleaks
16 verbose Linux 4.15.0-1007-aws
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v10.10.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 137
22 error myPleaks@0.0.0 start: ng serve
22 error Exit status 137
23 error Failed at the myPleaks@0.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 137, true ]
package.json
{
"name": "myPleaks",
"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": "^6.0.3",
"@angular/common": "^6.0.3",
"@angular/compiler": "^6.0.3",
"@angular/core": "^6.0.3",
"@angular/forms": "^6.0.3",
"@angular/http": "^6.0.3",
"@angular/platform-browser": "^6.0.3",
"@angular/platform-browser-dynamic": "^6.0.3",
"@angular/router": "^6.0.3",
"@ng-select/ng-select": "^2.0.2",
"@ng-bootstrap/ng-bootstrap": "^1.1.2",
"@swimlane/ngx-datatable": "^13.0.0",
"@swimlane/ngx-charts": "^8.1.0",
"angular-calendar": "^0.22.1",
"bootstrap": "^4.1.1",
"chart.js": "^2.7.1",
"chartist": "^0.11.0",
"core-js": "^2.4.1",
"jasmine": "^3.1.0",
"jquery": "^3.2.1",
"jquery-slimscroll": "^1.3.8",
"ng2-charts": "^1.6.0",
"ngx-bootstrap": "^2.0.5",
"ngx-uploader": "^6.0.1",
"ng2-dragula": "^1.5.0",
"ng2-file-upload": "^1.3.0",
"ngx-quill": "^3.1.0",
"pace-js": "^1.0.2",
"popper.js": "^1.12.5",
"rxjs": "^6.2.0",
"zone.js": "^0.8.4",
"rxjs-compat": "^6.0.0-rc.0",
"auth0-js": "^9.3.3",
"aws-sdk": "^2.233.1",
"ng2-datepicker": "^3.1.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.5",
"@angular/cli": "^6.1.5",
"@angular/compiler-cli": "^6.0.3",
"@angular/language-service": "^6.0.3",
"@types/chartist": "^0.9.37",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/jquery": "^3.2.5",
"@types/node": "~6.0.60",
"codelyzer": "~4.2.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.7.2"
}}
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"myPleaks": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/@ng-select/ng-select/themes/default.theme.css",
"src/styles.css",
"src/assets/scss/style.scss"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/pace-js/pace.min.js"
]
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "myPleaks:build",
"port": 8080
},
"configurations": {
"production": {
"browserTarget": "myPleaks:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "myPleaks:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/pace-js/pace.min.js"
],
"styles": [
"src/styles.css",
"src/assets/scss/style.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"myPleaks-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "myPleaks:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "myPleaks",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}}