IN ANGULAR in version 27.20.1 of netlify build I had no problem executing the Build command: npm run prerender, but in the current version 27.20.6 of netlify build when trying to execute the Build command: npm run prerender it gives me the following error, does anyone know how to fix it??
Looking at the below lines from your deploy log, it looks like you are being directed to the Angular docs for reconfiguring JS dependencies. Have you checked to make sure all of your dependencies are configured correctly?
3:40:32 AM: Warning: /opt/build/repo/node_modules/@techiediaries/ngx-qrcode/__ivy_ngcc__/fesm2015/techiediaries-ngx-qrcode.js depends on 'qrcode'. CommonJS or AMD dependencies can cause optimization bailouts.
3:40:32 AM: For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
3:40:32 AM:
3:40:32 AM: Warning: /opt/build/repo/src/app/helpers/scroll-to-top/scroll-to-top.component.ts depends on 'jquery'. CommonJS or AMD dependencies can cause optimization bailouts.
3:40:32 AM: For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Prerendering routes to /opt/build/repo/dist/spotbie/browser failed.
12:04:30 AM: Method Promise.prototype.then called on incompatible receiver [object Object]
Full log
12:02:39 AM: Build ready to start
12:02:57 AM: build-image version: 9289b698a503f132b265bd089ab40ce1d6f9e65e (focal)
12:02:57 AM: build-image tag: v4.12.0
12:02:57 AM: buildbot version: 2510ae842d7cc96532da2c05a74ba836f3e7f056
12:02:57 AM: Fetching cached dependencies
12:02:57 AM: Starting to download cache of 589.8MB
12:03:03 AM: Finished downloading cache in 5.249388818s
12:03:03 AM: Starting to extract cache
12:03:06 AM: Finished extracting cache in 3.067673046s
12:03:06 AM: Finished fetching cache in 8.397597436s
12:03:06 AM: Starting to prepare the repo for build
12:03:06 AM: Preparing Git Reference refs/heads/spotbie-staging
12:03:07 AM: Parsing package.json dependencies
12:03:08 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'functions' versus './functions' in the Netlify UI
12:03:08 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'npm run prerender' versus 'ng build --configuration production --output-hashing=all && ng run spotbie:server:production' in the Netlify UI
12:03:09 AM: Starting build script
12:03:09 AM: Installing dependencies
12:03:09 AM: Python version set to 2.7
12:03:09 AM: Started restoring cached node version
12:03:09 AM: Finished restoring cached node version
12:03:10 AM: Downloading and installing node v16.18.0...
12:03:10 AM: Downloading https://nodejs.org/dist/v16.18.0/node-v16.18.0-linux-x64.tar.xz...
12:03:10 AM: Computing checksum with sha256sum
12:03:10 AM: Checksums matched!
12:03:12 AM: Now using node v16.18.0 (npm v8.19.2)
12:03:12 AM: Started restoring cached build plugins
12:03:12 AM: Finished restoring cached build plugins
12:03:12 AM: Attempting ruby version 2.7.2, read from environment
12:03:13 AM: Using ruby version 2.7.2
12:03:13 AM: Using PHP version 8.0
12:03:13 AM: No npm workspaces detected
12:03:13 AM: Started restoring cached node modules
12:03:14 AM: Finished restoring cached node modules
12:03:14 AM: Installing NPM modules using NPM version 8.19.2
12:03:14 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:03:14 AM: npm WARN config location in the cache, and they are managed by
12:03:14 AM: npm WARN config [`cacache`](http://npm.im/cacache).
12:03:14 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:03:14 AM: npm WARN config location in the cache, and they are managed by
12:03:14 AM: npm WARN config [`cacache`](http://npm.im/cacache).
12:03:16 AM: removed 1 package, changed 1 package, and audited 1331 packages in 2s
12:03:16 AM: 120 packages are looking for funding
12:03:16 AM: run `npm fund` for details
12:03:17 AM: 7 vulnerabilities (2 moderate, 5 high)
12:03:17 AM: To address issues that do not require attention, run:
12:03:17 AM: npm audit fix
12:03:17 AM: To address all issues (including breaking changes), run:
12:03:17 AM: npm audit fix --force
12:03:17 AM: Run `npm audit` for details.
12:03:17 AM: NPM modules installed
12:03:17 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:03:17 AM: npm WARN config location in the cache, and they are managed by
12:03:17 AM: npm WARN config [`cacache`](http://npm.im/cacache).
12:03:17 AM: Started restoring cached go cache
12:03:17 AM: Finished restoring cached go cache
12:03:17 AM: Installing Go version 1.16.5 (requested 1.16.5)
12:03:20 AM: unset GOOS;
12:03:20 AM: unset GOARCH;
12:03:20 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64';
12:03:20 AM: export PATH="/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64/bin:${PATH}";
12:03:20 AM: go version >&2;
12:03:20 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.16.5.linux.amd64.env"
12:03:20 AM: go version go1.16.5 linux/amd64
12:03:20 AM: Installing missing commands
12:03:20 AM: Verify run directory
12:03:22 AM: β
12:03:22 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:03:22 AM: Netlify Build
12:03:22 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:03:22 AM: β
12:03:22 AM: β― Version
12:03:22 AM: @netlify/build 27.20.6
12:03:22 AM: β
12:03:22 AM: β― Flags
12:03:22 AM: baseRelDir: true
12:03:22 AM: buildId: 634e255f2936fc00078067cb
12:03:22 AM: deployId: 634e255f2936fc00078067cd
12:03:22 AM: β
12:03:22 AM: β― Current directory
12:03:22 AM: /opt/build/repo
12:03:22 AM: β
12:03:22 AM: β― Config file
12:03:22 AM: /opt/build/repo/netlify.toml
12:03:22 AM: β
12:03:22 AM: β― Context
12:03:22 AM: production
12:03:22 AM: β
12:03:22 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:03:22 AM: 1. build.command from netlify.toml
12:03:22 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:03:22 AM: β
12:03:22 AM: $ npm run prerender
12:03:22 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:03:22 AM: npm WARN config location in the cache, and they are managed by
12:03:22 AM: npm WARN config [`cacache`](http://npm.im/cacache).
12:03:22 AM: > spotbie@1.0.2 prerender
12:03:22 AM: > ng run spotbie:prerender
12:03:26 AM: Unable to extract routes from application.
12:03:27 AM: - Generating server application bundles (phase: setup)...
12:03:27 AM: - Generating browser application bundles (phase: setup)...
12:04:28 AM: β Browser application bundle generation complete.
12:04:28 AM: β Browser application bundle generation complete.
12:04:28 AM: - Copying assets...
12:04:28 AM: β Copying assets complete.
12:04:28 AM: - Generating index html...
12:04:28 AM: - Generating index html...
12:04:28 AM: 2 rules skipped due to selector errors:
12:04:28 AM: legend+* -> Cannot read properties of undefined (reading 'type')
12:04:28 AM: .table>>>* -> Did not expect successive traversals.
12:04:28 AM: β Index html generation complete.
12:04:28 AM: Initial Chunk Files | Names | Raw Size | Estimated Transfer Size
12:04:28 AM: main.c576b6c2871dbcff.js | main | 1.80 MB | 368.03 kB
12:04:28 AM: styles.24b55ab52e6442f9.css | styles | 344.20 kB | 42.33 kB
12:04:28 AM: scripts.b4fa07820ec355b6.js | scripts | 65.52 kB | 16.49 kB
12:04:28 AM: polyfills.be82455f66c99a0d.js | polyfills | 44.99 kB | 13.83 kB
12:04:28 AM: runtime.8b7a9216fe8326f8.js | runtime | 2.71 kB | 1.26 kB
12:04:28 AM:
12:04:28 AM: | Initial Total | 2.25 MB | 441.94 kB
12:04:28 AM:
12:04:28 AM: Lazy Chunk Files | Names | Raw Size | Estimated Transfer Size
12:04:28 AM: 45.53ad7e65770adb69.js | business-business-module | 2.08 kB | 975 bytes
12:04:28 AM:
12:04:28 AM: Build at: 2022-10-18T04:04:28.478Z - Hash: 6e9bedcd4a50447a - Time: 60730ms
12:04:28 AM:
12:04:28 AM: ./src/assets/bootstrap/css/bootstrap.min.css.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].rules[0].oneOf[0].use[2]!./src/assets/bootstrap/css/bootstrap.min.css - Warning: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
12:04:28 AM: Warning
12:04:28 AM:
12:04:28 AM: (6:27710) autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.
12:04:28 AM:
12:04:28 AM: Warning: /opt/build/repo/src/app/spotbie/map/info-object/info-object.component.css exceeded maximum budget. Budget 6.00 kB was not met by 742 bytes with a total of 6.72 kB.
12:04:28 AM:
12:04:28 AM: Warning: /opt/build/repo/src/app/spotbie/map/map.component.css exceeded maximum budget. Budget 6.00 kB was not met by 12.60 kB with a total of 18.60 kB.
12:04:28 AM:
12:04:28 AM: Warning: /opt/build/repo/src/app/spotbie/menu.component.css exceeded maximum budget. Budget 6.00 kB was not met by 3.17 kB with a total of 9.17 kB.
12:04:28 AM:
12:04:28 AM: Warning: /opt/build/repo/src/app/spotbie/spotbie-logged-in/settings/settings.component.css exceeded maximum budget. Budget 6.00 kB was not met by 432 bytes with a total of 6.42 kB.
12:04:28 AM:
12:04:28 AM: Warning: bundle initial exceeded maximum budget. Budget 2.00 MB was not met by 252.69 kB with a total of 2.25 MB.
12:04:28 AM:
12:04:28 AM:
12:04:29 AM: β Server application bundle generation complete.
12:04:29 AM: β Server application bundle generation complete.
12:04:29 AM: Initial Chunk Files | Names | Raw Size
12:04:29 AM: main.js | main | 5.94 MB |
12:04:29 AM:
12:04:29 AM: | Initial Total | 5.94 MB
12:04:29 AM:
12:04:29 AM: Lazy Chunk Files | Names | Raw Size
12:04:29 AM: 45.js | business-business-module | 3.79 kB |
12:04:29 AM:
12:04:29 AM: Build at: 2022-10-18T04:04:29.364Z - Hash: 7f0a5faa533b904b - Time: 61630ms
12:04:29 AM: - Prerendering 1 route(s) to /opt/build/repo/dist/spotbie/browser...
12:04:30 AM: β Prerendering routes to /opt/build/repo/dist/spotbie/browser failed.
12:04:30 AM: Method Promise.prototype.then called on incompatible receiver [object Object]
12:04:31 AM: β
12:04:31 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:04:31 AM: "build.command" failed
12:04:31 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
12:04:31 AM: β
12:04:31 AM: Error message
12:04:31 AM: Command failed with exit code 1: npm run prerender (https://ntl.fyi/exit-code-1)
12:04:31 AM: β
12:04:31 AM: Error location
12:04:31 AM: In build.command from netlify.toml:
12:04:31 AM: npm run prerender
12:04:31 AM: β
12:04:31 AM: Resolved config
12:04:31 AM: build:
12:04:31 AM: command: npm run prerender
12:04:31 AM: commandOrigin: config
12:04:31 AM: publish: /opt/build/repo/dist/spotbie/browser
12:04:31 AM: publishOrigin: config
12:04:31 AM: functionsDirectory: /opt/build/repo/functions
12:04:31 AM: Caching artifacts
12:04:31 AM: Started saving node modules
12:04:31 AM: Finished saving node modules
12:04:31 AM: Started saving build plugins
12:04:31 AM: Finished saving build plugins
12:04:31 AM: Started saving pip cache
12:04:31 AM: Finished saving pip cache
12:04:31 AM: Started saving emacs cask dependencies
12:04:31 AM: Finished saving emacs cask dependencies
12:04:31 AM: Started saving maven dependencies
12:04:31 AM: Finished saving maven dependencies
12:04:31 AM: Started saving boot dependencies
12:04:31 AM: Finished saving boot dependencies
12:04:31 AM: Started saving rust rustup cache
12:04:31 AM: Finished saving rust rustup cache
12:04:31 AM: Started saving go dependencies
12:04:31 AM: Finished saving go dependencies
12:04:32 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:04:32 AM: Creating deploy upload records
12:04:32 AM: Failing build: Failed to build site
12:04:32 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:04:33 AM: Finished processing build request in 1m35.30619162s```
Can you please describe the obstacle you are encountering?
This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.
If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!
@hillary Like the OP said and as I mentioned on my first post:
Prerendering routes to /opt/build/repo/dist/spotbie/browser failed.
12:04:30 AM: Method Promise.prototype.then called on incompatible receiver [object Object]
Iβm getting this message from the Netlify build logs whenever I run the CI build on Netlify.
Two weeks ago I was able to deploy with no issues. This is the same issue OP is having.
If I run βnpm run prerenderβ locally then it builds without any problems and Iβm able to upload my build successfully. However this breaks the CI flow I had set up.
I have the same issues as others mentioned above. I made sure that the window object and http client are only accessed when the app actually runs in the browser.
Do you have any other hints on what could be the issue?
Thanks so much for taking the time to come back and share your solution! We appreciate it. This will help future Forums members who encounter something similar.