Webpack error when build custom strapi project - 'use strict'

m trying to connect my existing mysql db to strapi.there for i created custom strapi project.when i tried to npm run develop, i got bellow error.

`Error: ./.cache/plugins/strapi-plugin-content-manager/admin/src/components/RepeatableComponent/Banner.js 2:87
Module parse failed: Unexpected token (2:87)
File was processed with these loaders:

./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| “use strict”;var _interopRequireDefault=require(“@babel/runtime/helpers/interopRequireDefault”);var _interopRequireWildcard=require(“@babel/runtime/helpers/interopRequireWildcard”);Object.defineProperty(exports,“__esModule”,{value:true});exports.default=void 0;var _react=_interopRequireWildcard(require(“react”));var _reactIntl=require(“react-intl”);var _propTypes=_interopRequireDefault(require(“prop-types”));var _icons=require(“@buffetjs/icons”);var _reactFontawesome=require(“@fortawesome/react-fontawesome”);var _pluginId=_interopRequireDefault(require(“…/…/pluginId”))

I tried these as well

  1. remove cache and build file
  2. remove node_modules
  3. run npm i
  4. run npm run develop

but same error


You can start new project from zero:

npx create-strapi-app my-project 

Attention! : don’t print --quickstart at the end!
After you send this command Strapi will ask you about your database connection and configure it.
During this process you can select MySQL or Postgress database.

After that you can simply trasfer your existing project to new insatallation.

1 Like
  • Strapi Version: ?
  • Operating System: ?
  • Node Version: ?
  • NPM Version: ?

Do you also use admin UI extensions? Or that’s a clean admin build.

Same issue …

  • Strapi Version: 3.6
  • Operating System: osx
  • Node Version: 12.14
  • NPM Version: 7.8.0

also i tried npx and yarn commands… this is new proj clean admin build…

Does this work for you? Strapi develop command failed - #10 by badsyntax

Is your Strapi project nested within another project that uses babel/webpack?

1 Like

You can find here more precise answer: node.js - Attempting to run strapi gives module parse error - Stack Overflow

Quote :point_down:

"Did you try like that?

  1. in your strapi folder, go to → node_modules/strapi-admin/webpack.config.js
  2. locate the line → require.resolve(’@babel/preset-env’)
  3. replace it with [require.resolve(’@babel/preset-env’),{ targets: ‘defaults’ }],
  4. run the command - npm run dev

For me, it works. But it’s just a workaround. With every packages update, it will be back to an earlier version."

@michalmodrzejewski can you confirm that you have nested strapi within another webpack project? It would be useful to know why this error occurs in the first place… changing node modules isn’t really a good solution, unless you use something like patch-package but even then it’s a slippery slope…

1 Like

Yes you are right. At first I thought not. But I had some old files in my directory with all my projects. Thank you very much! :tada: :heart:

1 Like