1

I am trying to set up the strapi. I managed to create app succesfully. But when I run the command yarn develop I get following errors

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.

What I have tried so far:

  • created new app
  • tried solution from this link
  • tried creating app using templates
  • tried updating babel
  • tried updating all packages

I haven't find anything helpful on Strapi website or github issues

3 Answers 3

1

Finally, I managed to resolve the issue. You need to update the webpack.config.js from

require.resolve('@babel/preset-env')

to

[require.resolve('@babel/preset-env'),{ targets: "defaults" }]

inside the module options

Sign up to request clarification or add additional context in comments.

Comments

0

You can find here more precise answer: https://stackoverflow.com/a/68531196/13282460

Quote 👇

"1. Better solution.

Check if your Strapi project is nested within another project that uses babel/webpack. I had some old files in my directory with all my projects. When I removed them, it works.

2. Workaround solution (With every packages update, it will be back to an earlier version)

  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"

Comments

0

All the answers above did not work for me for Strapi 3.6.8 using a customized admin panel, the error appeared suddenly. Some answers mention a main file but that was a bit vague so I had to experiment a bit. I hope this helps someone. Here is how I fixed mine:

  1. Added the following to packages.json

    "browserslist": [ "since 2017-06" ],

  2. Added the following line into admin/src/app.js

    import 'regenerator-runtime/runtime';

  3. Run npm run build then npm start

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.