ModuleParseError: Module parse failed: Unexpected token (10:37) You may need an appropriate loader to handle this file type

Hi, I am trying to deploy my repository and I am getting this error:

ModuleParseError: Module parse failed: Unexpected token (10:37)
7:38:51 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See Concepts | webpack
7:38:51 PM: | “x-amz-sso_bearer_token”: input.accessToken,
7:38:51 PM: | });
7:38:51 PM: > const resolvedPath = ${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""} + “/federation/credentials”;
7:38:51 PM: | const query = map({
7:38:51 PM: | role_name: [, __expectNonNull(input.roleName, roleName)],
7:38:51 PM: at handleParseError (/opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:469:19)
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:503:5
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:358:12
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:373:3
7:38:51 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
7:38:51 PM: at Array. (/opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
7:38:51 PM: at Storage.finished (/opt/build/repo/node_modules/netlify-lambda/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
7:38:51 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
7:38:52 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
7:38:51 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
7:38:51 PM: ModuleParseError: Module parse failed: Unexpected token (10:50)
7:38:51 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See Concepts | webpack
7:38:51 PM: | }, { …config }, context);
7:38:51 PM: | context.endpointV2 = endpoint;
7:38:51 PM: > context.authSchemes = endpoint.properties?.authSchemes;
7:38:51 PM: | const authScheme = context.authSchemes?.[0];
7:38:51 PM: | if (authScheme) {
7:38:51 PM: at handleParseError (/opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:469:19)
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:503:5
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:358:12
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:373:3
7:38:51 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
7:38:51 PM: at Array. (/opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
7:38:51 PM: at Storage.finished (/opt/build/repo/node_modules/netlify-lambda/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
7:38:51 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
7:38:51 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
7:38:51 PM: ModuleParseError: Module parse failed: Unexpected token (11:28)
7:38:51 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See Concepts | webpack
7:38:51 PM: | this.lastTimestamp = 0;
7:38:51 PM: | this.timeWindow = 0;
7:38:51 PM: > this.beta = options?.beta ?? 0.7;
7:38:51 PM: | this.minCapacity = options?.minCapacity ?? 1;
7:38:51 PM: | this.minFillRate = options?.minFillRate ?? 0.5;
7:38:51 PM: at handleParseError (/opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:469:19)
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:503:5
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/webpack/lib/NormalModule.js:358:12
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:373:3
7:38:51 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
7:38:51 PM: at Array. (/opt/build/repo/node_modules/netlify-lambda/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
7:38:51 PM: at Storage.finished (/opt/build/repo/node_modules/netlify-lambda/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
7:38:51 PM: at /opt/build/repo/node_modules/netlify-lambda/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
7:38:51 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
7:38:51 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3),
7:38:51 PM:

Hi there, glad you found us before we can help you, we need a little more information on the issues you are facing.

First, have you looked through this resource? It is a compilation of all of our build and deploy resources. This is a good starting point.

If you have worked through those guides and are still encountering issues please share the following information:

  • the name of your build instance: “example-jones.netlify.com
  • what you have already tried
  • any error messages you have received in your terminal window or in the developer console

I couldn’t find the solution in that documents.
=> https://english-quiz-app.netlify.app/
=> I tried to install @babel/ → plugin-proposal-private-methods, preset-env, core and add this plugin to a file named .babelrc and create a file named webpack.config.babel.js. I did all these using chatgpt but these didn’t help.
=> I already gave the error but if you’d like I can send the github repository. I am new to node js I am just trying to deploy my backend in a website.

@neilbishop Someone may be able to help you, but the issue is with your build, not Netlify, so is beyond the Netlify Scope of Support.

Base functionality of Netlify’s build and deploy pipeline is supported, but we cannot help you debug any source code used either during build or after deployment.

It’s ultimately your own responsibility to understand the code that you’re deploying and to be able to debug it as necessary.

If you cannot do it yourself, or get chatgpt to write you code that doesn’t error, then you may need to seek a freelancer to assist you.