I’m getting the error below in building stage:
There was an error when loading the 'crypto' npm module. Support for npm modules in edge functions is an experimental feature.
Refer to https://ntl.fyi/edge-functions-npm for more information.
Site name
leet-o.netlify.app
currently using Astro in the last successful build, but the error occurs in my attempt to migrate to Angular 18 SSR
Build settings
Repo
https://github.com/HMLarsen/Leet/tree/version/angular-18
Deploy log
2:11:22 AM: build-image version: ecdc8b770f4a0193fd3f258c1bc6029e681813a4 (focal)
2:11:22 AM: buildbot version: ecdc8b770f4a0193fd3f258c1bc6029e681813a4
2:11:22 AM: Building without cache
2:11:22 AM: Starting to prepare the repo for build
2:11:23 AM: No cached dependencies found. Cloning fresh repo
2:11:23 AM: git clone --filter=blob:none https://github.com/HMLarsen/Leet
2:11:23 AM: Preparing Git Reference refs/heads/version/angular-18
2:11:24 AM: Custom functions path detected. Proceeding with the specified path: 'netlify/functions'
2:11:24 AM: Starting to install dependencies
2:11:24 AM: Python version set to 3.8
2:11:25 AM: Attempting Ruby version 2.7.2, read from environment
2:11:25 AM: Using Ruby version 2.7.2
2:11:26 AM: Started restoring cached go cache
2:11:26 AM: Finished restoring cached go cache
2:11:26 AM: go version go1.19.13 linux/amd64
2:11:26 AM: Using PHP version 8.0
2:11:28 AM: Downloading and installing node v20.16.0...
2:11:28 AM: Downloading https://nodejs.org/dist/v20.16.0/node-v20.16.0-linux-x64.tar.xz...
2:11:28 AM: Computing checksum with sha256sum
2:11:28 AM: Checksums matched!
2:11:30 AM: Now using node v20.16.0 (npm v10.8.1)
2:11:30 AM: Enabling Node.js Corepack
2:11:30 AM: Started restoring cached build plugins
2:11:30 AM: Finished restoring cached build plugins
2:11:30 AM: Started restoring cached corepack dependencies
2:11:30 AM: Finished restoring cached corepack dependencies
2:11:30 AM: No npm workspaces detected
2:11:30 AM: Started restoring cached node modules
2:11:30 AM: Finished restoring cached node modules
2:11:30 AM: Installing npm packages using npm version 10.8.1
2:11:32 AM: npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
2:11:33 AM: npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
2:11:33 AM: npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
2:11:40 AM: added 1110 packages, and audited 1111 packages in 10s
2:11:40 AM: 148 packages are looking for funding
2:11:40 AM: run `npm fund` for details
2:11:40 AM: found 0 vulnerabilities
2:11:40 AM: npm packages installed
2:11:41 AM: Successfully installed dependencies
2:11:41 AM: Starting build script
2:11:42 AM: Detected 1 framework(s)
2:11:42 AM: "angular" at version "18.1.1"
2:11:42 AM: Section completed: initializing
2:11:43 AM:
2:11:43 AM: Netlify Build
2:11:43 AM: ────────────────────────────────────────────────────────────────
2:11:43 AM:
2:11:43 AM: ❯ Version
2:11:43 AM: @netlify/build 29.51.3
2:11:43 AM:
2:11:43 AM: ❯ Flags
2:11:43 AM: baseRelDir: true
2:11:43 AM: buildId: 66a1de7005f758a1c76d5df1
2:11:43 AM: deployId: 66a1de7005f758a1c76d5df3
2:11:43 AM:
2:11:43 AM: ❯ Current directory
2:11:43 AM: /opt/build/repo
2:11:43 AM:
2:11:43 AM: ❯ Config file
2:11:43 AM: /opt/build/repo/netlify.toml
2:11:43 AM:
2:11:43 AM: ❯ Context
2:11:43 AM: production
2:11:43 AM:
2:11:43 AM: ❯ Installing plugins
2:11:43 AM: - @netlify/angular-runtime@2.1.0
2:11:44 AM:
2:11:44 AM: ❯ Loading plugins
2:11:44 AM: - @netlify/angular-runtime@2.1.0 from Netlify app
2:11:46 AM:
2:11:46 AM: build.command from netlify.toml
2:11:46 AM: ────────────────────────────────────────────────────────────────
2:11:46 AM:
2:11:46 AM: $ npm run build
2:11:46 AM: > leet@0.0.0 build
2:11:46 AM: > ng build
2:11:46 AM: - Building...
2:11:58 AM: Browser bundles
2:11:58 AM: Initial chunk files | Names | Raw size | Estimated transfer size
2:11:58 AM: main-FJLAEATY.js | main | 613.73 kB | 162.86 kB
2:11:58 AM: polyfills-SCHOHYNV.js | polyfills | 34.52 kB | 11.29 kB
2:11:58 AM: styles-5INURTSO.css | styles | 0 bytes | 0 bytes
2:11:58 AM: | Initial total | 648.25 kB | 174.15 kB
2:11:58 AM: Server bundles
2:11:58 AM: Initial chunk files | Names | Raw size
2:11:58 AM: chunk-UBTZCY67.mjs | - | 1.47 MB |
2:11:58 AM: server.mjs | server | 1.11 MB |
2:11:58 AM: chunk-XZVGCFBQ.mjs | - | 564.26 kB |
2:11:58 AM: polyfills.server.mjs | polyfills.server | 268.61 kB |
2:11:58 AM: chunk-WUI6SWGE.mjs | - | 2.82 kB |
2:11:58 AM: render-utils.server.mjs | render-utils.server | 1.47 kB |
2:11:58 AM: main.server.mjs | main.server | 149 bytes |
2:11:58 AM: Lazy chunk files | Names | Raw size
2:11:58 AM: chunk-4JMZSEDO.mjs | xhr2 | 12.08 kB |
2:11:58 AM: Prerendered 4 static routes.
2:11:58 AM: Output location: /opt/build/repo/dist/leet
2:11:58 AM: Application bundle generation complete. [12.163 seconds]
2:11:58 AM: ▲ [WARNING] bundle initial exceeded maximum budget. Budget 512.00 kB was not met by 136.25 kB with a total of 648.25 kB.
2:11:58 AM: ▲ [WARNING] Module 'undici' used by 'node_modules/@firebase/auth/dist/node-esm/index.js' is not ESM
2:11:58 AM: CommonJS or AMD dependencies can cause optimization bailouts.
2:11:58 AM: For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies
2:11:58 AM: ▲ [WARNING] Module '@grpc/grpc-js' used by 'node_modules/@firebase/firestore/dist/index.node.mjs' is not ESM
2:11:58 AM: CommonJS or AMD dependencies can cause optimization bailouts.
2:11:58 AM: For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies
2:11:58 AM: ▲ [WARNING] Module '@grpc/proto-loader' used by 'node_modules/@firebase/firestore/dist/index.node.mjs' is not ESM
2:11:58 AM: CommonJS or AMD dependencies can cause optimization bailouts.
2:11:58 AM: For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies
2:11:58 AM: ▲ [WARNING] Module 'undici' used by 'node_modules/@firebase/storage/dist/node-esm/index.node.esm.js' is not ESM
2:11:58 AM: CommonJS or AMD dependencies can cause optimization bailouts.
2:11:58 AM: For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies
2:11:58 AM:
2:11:58 AM:
2:11:58 AM: (build.command completed in 12.8s)
2:11:58 AM: Writing Angular SSR Edge Function ...
2:11:58 AM:
2:11:58 AM: Functions bundling
2:11:58 AM: ────────────────────────────────────────────────────────────────
2:11:58 AM:
2:11:58 AM: The Netlify Functions setting targets a non-existing directory: netlify/functions
2:11:58 AM:
2:11:58 AM: (Functions bundling completed in 2ms)
2:11:58 AM:
2:11:58 AM: Edge Functions bundling
2:11:58 AM: ────────────────────────────────────────────────────────────────
2:11:58 AM:
2:11:58 AM: Packaging Edge Functions from .netlify/edge-functions directory:
2:11:58 AM: - angular-ssr
2:12:02 AM:
2:12:02 AM: Bundling of edge function failed
2:12:02 AM: ────────────────────────────────────────────────────────────────
2:12:02 AM:
2:12:02 AM: Error message
2:12:02 AM: There was an error when loading the 'crypto' npm module. Support for npm modules in edge functions is an experimental feature. Refer to https://ntl.fyi/edge-functions-npm for more information.
2:12:02 AM:
2:12:02 AM: Error location
2:12:02 AM: While bundling edge function
2:12:02 AM:
2:12:02 AM: Resolved config
2:12:02 AM: build:
2:12:02 AM: command: npm run build
2:12:02 AM: commandOrigin: config
2:12:02 AM: publish: /opt/build/repo/dist/leet/browser
2:12:02 AM: publishOrigin: config
2:12:02 AM: functionsDirectory: /opt/build/repo/netlify/functions
2:12:02 AM: plugins:
2:12:02 AM: - inputs: {}
2:12:02 AM: origin: ui
2:12:02 AM: package: '@netlify/angular-runtime'
2:12:03 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
2:12:03 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:12:03 AM: Failing build: Failed to build site
2:12:03 AM: Finished processing build request in 40.752s