Build fails in the console with the most recent versions of @angular/cli and @angular-devkit/build-angular
Edit package.json
Backend build will succeed
2020-02-16T19:26:34.135Z [INFO]: ## Starting Frontend Build
# Starting phase: preBuild
# Executing command: npm ci
2020-02-16T19:26:52.262Z [INFO]: > [email protected] install /codebuild/output/src394512002/src/APP/node_modules/webpack-dev-server/node_modules/fsevents
> node-gyp rebuild
2020-02-16T19:26:52.451Z [WARNING]: gyp
2020-02-16T19:26:52.452Z [WARNING]:
2020-02-16T19:26:52.452Z [WARNING]: info it worked if it ends with ok
2020-02-16T19:26:52.454Z [WARNING]: gyp
2020-02-16T19:26:52.455Z [WARNING]: info using [email protected]
gyp info using [email protected] | linux | x64
2020-02-16T19:26:53.383Z [WARNING]: gyp
2020-02-16T19:26:53.386Z [WARNING]: info spawn /usr/bin/python2
gyp info spawn args [ '/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/codebuild/output/src394512002/src/APP/node_modules/webpack-dev-server/node_modules/fsevents/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.node-gyp/10.16.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.node-gyp/10.16.0',
gyp info spawn args '-Dnode_gyp_dir=/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.node-gyp/10.16.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/codebuild/output/src394512002/src/APP/node_modules/webpack-dev-server/node_modules/fsevents',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
2020-02-16T19:26:53.818Z [WARNING]: gyp info
2020-02-16T19:26:53.819Z [WARNING]: spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
2020-02-16T19:26:53.821Z [INFO]: make: Entering directory `/codebuild/output/src394512002/src/APP/node_modules/webpack-dev-server/node_modules/fsevents/build'
2020-02-16T19:26:53.844Z [INFO]: SOLINK_MODULE(target) Release/obj.target/.node
2020-02-16T19:26:54.389Z [INFO]: COPY Release/.node
2020-02-16T19:26:54.395Z [INFO]: make: Leaving directory `/codebuild/output/src394512002/src/APP/node_modules/webpack-dev-server/node_modules/fsevents/build'
2020-02-16T19:26:54.395Z [WARNING]: gyp
2020-02-16T19:26:54.396Z [WARNING]: info ok
2020-02-16T19:26:54.450Z [INFO]: > [email protected] install /codebuild/output/src394512002/src/APP/node_modules/watchpack/node_modules/fsevents
> node-gyp rebuild
2020-02-16T19:26:54.551Z [WARNING]: gyp
2020-02-16T19:26:54.552Z [WARNING]: info it worked if it ends with ok
2020-02-16T19:26:54.554Z [WARNING]: gyp
2020-02-16T19:26:54.555Z [WARNING]: info using [email protected]
gyp info using [email protected] | linux | x64
2020-02-16T19:26:54.708Z [WARNING]: gyp
2020-02-16T19:26:54.708Z [WARNING]: info spawn /usr/bin/python2
gyp info spawn args [ '/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
2020-02-16T19:26:54.708Z [WARNING]: gyp info spawn args '/codebuild/output/src394512002/src/APP/node_modules/watchpack/node_modules/fsevents/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args
2020-02-16T19:26:54.709Z [WARNING]: '/root/.node-gyp/10.16.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.node-gyp/10.16.0',
gyp info spawn args '-Dnode_gyp_dir=/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/node-gyp',
gyp
2020-02-16T19:26:54.709Z [WARNING]: info spawn args '-Dnode_lib_file=/root/.node-gyp/10.16.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/codebuild/output/src394512002/src/APP/node_modules/watchpack/node_modules/fsevents',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args
2020-02-16T19:26:54.709Z [WARNING]: '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
2020-02-16T19:26:54.756Z [WARNING]: gyp
2020-02-16T19:26:54.756Z [WARNING]: info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
2020-02-16T19:26:54.757Z [INFO]: make: Entering directory `/codebuild/output/src394512002/src/APP/node_modules/watchpack/node_modules/fsevents/build'
2020-02-16T19:26:54.759Z [INFO]: SOLINK_MODULE(target) Release/obj.target/.node
2020-02-16T19:26:54.806Z [INFO]: COPY Release/.node
2020-02-16T19:26:54.812Z [INFO]: make: Leaving directory `/codebuild/output/src394512002/src/APP/node_modules/watchpack/node_modules/fsevents/build'
2020-02-16T19:26:54.812Z [WARNING]: gyp
2020-02-16T19:26:54.812Z [WARNING]: info ok
2020-02-16T19:26:54.924Z [INFO]: > [email protected] postinstall /codebuild/output/src394512002/src/APP/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
2020-02-16T19:26:55.007Z [INFO]: > [email protected] postinstall /codebuild/output/src394512002/src/APP/node_modules/core-js
> node scripts/postinstall || echo "ignore"
2020-02-16T19:26:55.067Z [INFO]: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
2020-02-16T19:26:55.068Z [INFO]: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
2020-02-16T19:26:55.068Z [INFO]: > https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
2020-02-16T19:26:55.204Z [INFO]: > [email protected] postinstall /codebuild/output/src394512002/src/APP/node_modules/karma/node_modules/core-js
> node postinstall || echo "ignore"
2020-02-16T19:26:55.300Z [INFO]: > [email protected] install /codebuild/output/src394512002/src/APP/node_modules/karma/node_modules/fsevents
> node install
2020-02-16T19:26:55.383Z [INFO]: > [email protected] postinstall /codebuild/output/src394512002/src/APP/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
2020-02-16T19:26:55.483Z [INFO]: > [email protected] install /codebuild/output/src394512002/src/APP/node_modules/@angular/compiler-cli/node_modules/fsevents
> node install
2020-02-16T19:26:55.583Z [INFO]: > @angular/[email protected] postinstall /codebuild/output/src394512002/src/APP/node_modules/@angular/cli
> node ./bin/postinstall/script.js
2020-02-16T19:26:56.025Z [INFO]: added 1277 packages in 21.439s
2020-02-16T19:26:56.039Z [INFO]: # Completed phase: preBuild
# Starting phase: build
2020-02-16T19:26:56.040Z [INFO]: # Executing command: npm run build
2020-02-16T19:26:56.254Z [INFO]: > [email protected] build /codebuild/output/src394512002/src/APP
> ng build
2020-02-16T19:27:23.499Z [INFO]: Generating ES5 bundles for differential loading...
2020-02-16T19:27:23.501Z [INFO]:
2020-02-16T19:31:04.292Z [WARNING]: An unhandled exception occurred: Call retries were exceeded
See "/tmp/ng-FdB7IL/angular-errors.log" for further details.
2020-02-16T19:31:04.316Z [WARNING]: npm
2020-02-16T19:31:04.318Z [WARNING]: ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] build: `ng build`
npm ERR! spawn ENOENT
npm
2020-02-16T19:31:04.320Z [WARNING]: ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-02-16T19:31:04.333Z [WARNING]:
2020-02-16T19:31:04.336Z [WARNING]: npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-02-16T19_31_04_325Z-debug.log
2020-02-16T19:31:04.336Z [HELP]: Outputting the npm debug log
0 info it worked if it ends with ok
1 verbose cli [ '/root/.nvm/versions/node/v10.16.0/bin/node',
1 verbose cli '/root/.nvm/versions/node/v10.16.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/codebuild/output/src394512002/src/APP/node_modules/.bin:/usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.nvm/versions/node/v10.16.0/bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle [email protected]~build: CWD: /codebuild/output/src394512002/src/APP
10 silly lifecycle [email protected]~build: Args: [ '-c', 'ng build' ]
11 info lifecycle [email protected]~build: Failed to exec build script
12 verbose stack Error: [email protected] build: `ng build`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/root/.nvm/versions/node/v10.16.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:198:13)
12 verbose stack at maybeClose (internal/child_process.js:982:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
13 verbose pkgid [email protected]
14 verbose cwd /codebuild/output/src394512002/src/APP
15 verbose Linux 4.14.152-98.182.amzn1.x86_64
16 verbose argv "/root/.nvm/versions/node/v10.16.0/bin/node" "/root/.nvm/versions/node/v10.16.0/bin/npm" "run" "build"
17 verbose node v10.16.0
18 verbose npm v6.9.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error [email protected] build: `ng build`
23 error spawn ENOENT
24 error Failed at the [email protected] build script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
2020-02-16T19:31:04.339Z [ERROR]: !!! Build failed
2020-02-16T19:31:04.383Z [ERROR]: !!! Non-Zero Exit Code detected
2020-02-16T19:31:04.383Z [INFO]: # Starting environment caching...
2020-02-16T19:31:04.384Z [INFO]: # Environment caching completed
Terminating logging...
version: 0.1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: dist/APP
files:
- '**/*'
cache:
paths:
- node_modules/**/*
"devDependencies": {
"@angular-devkit/build-angular": "0.803.25",
"@angular/cli": "8.3.25",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"buffer": "^5.4.3",
"codelyzer": "^5.2.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.5.2",
"protractor": "^5.4.3",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
Change devDependencies:
"@angular-devkit/build-angular": "0.803.20",
"@angular/cli": "8.3.20",
This seems unrelated to Amplify specifically - seems on angular side:
An unhandled exception occurred: Call retries were exceeded
See "/tmp/ng-FdB7IL/angular-errors.log" for further details.
If you have questions related to amplify specifically please feel free to open another issue.
This seems unrelated to Amplify specifically - seems on angular side:
An unhandled exception occurred: Call retries were exceeded
See "/tmp/ng-FdB7IL/angular-errors.log" for further details.If you have questions related to amplify specifically please feel free to open another issue.
@ganipcanot - thank you for your response - I understand your perspective and view but would like to think that there is another way to look at it...
Sorry for the long response and the next overly dramatic statements :roll_eyes:
Anyway - if you wouldn't mind reconsidering or discussing with a colleague or something that would be appreciated!
Also - I can't see a way to get the angular-errors.log - if you could provide that via private message then that would be appreciated and might lead to an alternative work around.
Additionally I did read that node 12 does not have the same issue, currently the Amplify Console is using 10. I imagine that CodeBuild is being used behind the scenes - would it be possible to add node 12 capability through the console? (it is possible through CodeBuild see this)
@SimonLegg I had the same issue now and found this stackoverflow question that helped me switching the amplify console to use Node 12 with help of nvm use $VERSION_NODE_12.
Example:
version: 0.1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- nvm use $VERSION_NODE_12
- npm ci
build:
commands:
- nvm use $VERSION_NODE_12
- node -v
- npm run-script build
artifacts:
baseDirectory: dist/cr-client
files:
- '**/*'
cache:
paths:
- node_modules/**/*
@atlesp - thanks that is really helpful!
in addition, for anyone following the trail using Angular 9 - there is a warning in the Amplify GitHub documentation that Angular 9 is not supported currently - although I haven't tried with Node 12 yet
@atlesp thank you so much. I spent around a day trying to fix this problem and I was about ready to ram my head through a wall.
Now I can finally move on, this was driving me so insane I'm tearing up now that it's finally solved.
I am still getting same issue.
Any workaround for this?
@atlesp thanks 馃檹 It worked for me for a create react app.
@atlesp super helpful thank you 馃檹
Helped me with a create react app build
Yes it helped in a create react app build . Thanks
Most helpful comment
@SimonLegg I had the same issue now and found this stackoverflow question that helped me switching the amplify console to use Node 12 with help of
nvm use $VERSION_NODE_12.Example: