Hi, I run into a problem recently, my express service worked fine on netlify before, and last commit I changed some business code, then cannot build success ever!
This is my site: tc-backend.netlify.app
And below is the build log(remove some content because of word count limit), I have checked it, found error when netlify-lambda build express
, seems is about ‘webpack’, but this is a nodejs service, I haven’t install ‘webpack’, and the package-lock file shows thenetlify-lambda
package required ‘webpack’, now I have no clue how to fix this. can anyone please lend me a hand?
...
4:38:30 PM: $ npm install && npm run build
4:38:32 PM: npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
4:38:33 PM: npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
4:38:34 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
4:38:35 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
4:38:36 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
4:38:36 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
4:38:38 PM: added 839 packages, changed 13 packages, and audited 853 packages in 7s
4:38:38 PM: 41 packages are looking for funding
4:38:38 PM: run `npm fund` for details
4:38:38 PM: 5 high severity vulnerabilities
4:38:38 PM: To address all issues, run:
4:38:38 PM: npm audit fix
4:38:38 PM: Run `npm audit` for details.
4:38:38 PM: > training-course-backend@0.0.1 build
4:38:38 PM: > netlify-lambda build express
4:38:38 PM: netlify-lambda: Building functions
4:38:47 PM: [
4:38:47 PM: ModuleParseError: Module parse failed: Unexpected token (10:37)
4:38:47 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:38:47 PM: | "x-amz-sso_bearer_token": input.accessToken,
4:38:47 PM: | });
4:38:47 PM: > const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/federation/credentials";
4:38:47 PM: | const query = map({
4:38:47 PM: | role_name: [, input.roleName],
4:38:47 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:469:19)
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
4:38:47 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
4:38:47 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
4:38:47 PM: at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
4:38:47 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
4:38:47 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
4:38:47 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
4:38:47 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
4:38:47 PM: ModuleParseError: Module parse failed: Unexpected token (10:50)
4:38:47 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:38:47 PM: | }, { ...config }, context);
4:38:47 PM: | context.endpointV2 = endpoint;
4:38:47 PM: > context.authSchemes = endpoint.properties?.authSchemes;
4:38:47 PM: | const authScheme = context.authSchemes?.[0];
4:38:47 PM: | if (authScheme) {
4:38:47 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:469:19)
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
4:38:47 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
4:38:47 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
4:38:47 PM: at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
4:38:47 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
4:38:47 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
4:38:47 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
4:38:47 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
4:38:47 PM: ModuleParseError: Module parse failed: Unexpected token (11:28)
4:38:47 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:38:47 PM: | this.lastTimestamp = 0;
4:38:47 PM: | this.timeWindow = 0;
4:38:47 PM: > this.beta = options?.beta ?? 0.7;
4:38:47 PM: | this.minCapacity = options?.minCapacity ?? 1;
4:38:47 PM: | this.minFillRate = options?.minFillRate ?? 0.5;
4:38:47 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:469:19)
4:38:48 PM: Creating deploy upload records
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
4:38:47 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
4:38:47 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
4:38:47 PM: at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
4:38:49 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:38:47 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
4:38:47 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
4:38:47 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
4:38:47 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
4:38:47 PM: ModuleParseError: Module parse failed: Unexpected token (13:36)
4:38:47 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:38:47 PM: | this.maxAttemptsProvider = maxAttemptsProvider;
4:38:47 PM: | this.mode = RETRY_MODES.STANDARD;
4:38:47 PM: > this.retryDecider = options?.retryDecider ?? defaultRetryDecider;
4:38:47 PM: | this.delayDecider = options?.delayDecider ?? defaultDelayDecider;
4:38:47 PM: | this.retryQuota = options?.retryQuota ?? getDefaultRetryQuota(INITIAL_RETRY_TOKENS);
4:38:47 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:469:19)
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
4:38:47 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
4:38:47 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
4:38:47 PM: at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
4:38:47 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
4:38:47 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
4:38:47 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
4:38:47 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
...
4:38:47 PM: ModuleParseError: Module parse failed: Unexpected token (7:84)
4:38:47 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:38:47 PM: | export const getRegionInfo = (region, { useFipsEndpoint = false, useDualstackEndpoint = false, signingService, regionHash, partitionHash, }) => {
4:38:47 PM: | const partition = getResolvedPartition(region, { partitionHash });
4:38:47 PM: > const resolvedRegion = region in regionHash ? region : partitionHash[partition]?.endpoint ?? region;
4:38:47 PM: | const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint };
4:38:47 PM: | const regionHostname = getHostnameFromVariants(regionHash[resolvedRegion]?.variants, hostnameOptions);
4:38:47 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:469:19)
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
4:38:47 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
4:38:47 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
4:38:47 PM: at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
4:38:47 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
4:38:47 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
4:38:47 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
4:38:47 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
4:38:47 PM: ModuleParseError: Module parse failed: Unexpected token (8:24)
4:38:47 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:38:47 PM: | return {
4:38:47 PM: | ...input,
4:38:47 PM: > tls: input.tls ?? true,
4:38:47 PM: | endpoint: endpoint
4:38:47 PM: | ? normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint)
4:38:47 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:469:19)
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
4:38:47 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
4:38:47 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
4:38:47 PM: at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
4:38:47 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
4:38:47 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
4:38:47 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
4:38:47 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
4:38:47 PM: ModuleParseError: Module parse failed: Unexpected token (8:30)
4:38:47 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:38:47 PM: | return next(args);
4:38:47 PM: | const { headers } = request;
4:38:47 PM: > const userAgent = context?.userAgent?.map(escapeUserAgent) || [];
4:38:47 PM: | const defaultUserAgent = (await options.defaultUserAgentProvider()).map(escapeUserAgent);
4:38:47 PM: | const customUserAgent = options?.customUserAgent?.map(escapeUserAgent) || [];
4:38:47 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:469:19)
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
4:38:47 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
4:38:47 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
4:38:47 PM: at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
4:38:47 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
4:38:47 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
4:38:47 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
4:38:47 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
4:38:47 PM: ModuleParseError: Module parse failed: Unexpected token (9:39)
4:38:47 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:38:47 PM: | method: "GET",
4:38:47 PM: | ...options,
4:38:47 PM: > hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1"),
4:38:47 PM: | });
4:38:47 PM: | req.on("error", (err) => {
4:38:47 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:469:19)
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
4:38:47 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
4:38:47 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
4:38:47 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
4:38:47 PM: at Array.<anonymous> (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
4:38:47 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
4:38:47 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
4:38:47 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
4:38:47 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
4:38:47 PM: ]
4:38:47 PM:
4:38:47 PM: ────────────────────────────────────────────────────────────────
4:38:47 PM: "build.command" failed
4:38:47 PM: ────────────────────────────────────────────────────────────────
4:38:47 PM:
4:38:47 PM: Error message
4:38:47 PM: Command failed with exit code 1: npm install && npm run build (https://ntl.fyi/exit-code-1)
4:38:47 PM:
4:38:47 PM: Error location
4:38:47 PM: In build.command from netlify.toml:
4:38:47 PM: npm install && npm run build
4:38:47 PM:
4:38:47 PM: Resolved config
4:38:47 PM: build:
4:38:47 PM: command: npm install && npm run build
4:38:47 PM: commandOrigin: config
4:38:47 PM: environment:
4:38:47 PM: - MONGO_URL
4:38:47 PM: - NO_ENV_FILE
4:38:47 PM: publish: /opt/build/repo
4:38:47 PM: publishOrigin: default
4:38:47 PM: functionsDirectory: /opt/build/repo/functions
4:38:47 PM: Caching artifacts
4:38:47 PM: Started saving node modules
...