Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

220
Visualizações
Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"

My react native project worked fine yesterday. But this morning, after I tried to run it again, it gave me the following error:

error node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js: Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression". Run CLI with --verbose flag for more details.
TypeError: Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"

I'm not sure what it means, though. How can I solve this issue?

over 4 years ago · Santiago Trujillo
6 Respostas
Responde à pergunta

0

Apparently, it may be a problem with the babel. Copy the folder @babel (specifically @babel/core) that is in the node_modules of a working project into the new project and it runs without problems.

It may be due to an update they did a couple of hours ago.

You can also remove the current @babel/core from the package.json and install this version npm install --save-dev @babel/core@latest.

Or use this:
@babel file: https://drive.google.com/file/d/1-z_4H_z4x075unZqZD41WYUwY_hsrKox/view.

Or replace the following codes in your package.json file then npm install.

"@babel/core": "~7.14.0",
"@babel/compat-data": "~7.14.0",
"@babel/generator": "~7.14.0",
"@babel/helper-compilation-targets": "~7.14.0",
"@babel/helper-create-class-features-plugin": "~7.14.0",
"@babel/helper-create-regexp-features-plugin": "~7.14.0",
"@babel/helper-member-expression-to-functions": "~7.14.0",
"@babel/helper-module-transforms": "~7.14.0",
"@babel/helper-replace-supers": "~7.14.0",
"@babel/plugin-transform-react-display-name": "~7.14.0",
"@babel/plugin-transform-runtime": "~7.14.0",
"@babel/types": "~7.14.0",
over 4 years ago · Santiago Trujillo Relatório

0

copy @babel from some other project and paste in node_modules is the only solution for now

over 4 years ago · Santiago Trujillo Relatório

0

This appears to be a bug with 7.15.0 of Babel which they are making a E2E React native regression test for.

Updated answer

A few hours ago they have released the fix. It is due to a change to @babel/plugin-transform-react-display-name which has been reverted in 7.15.1. With that fix, you should be able to remove the extra entries in the package.json from my original answer and instead do the following.

npm install --save-dev @babel/core@latest

Original answer

Unfortunately, simply downgrading @babel/core to 7.14 will not be enough because it seems to pull the latest dependencies for the other components. Instead what you need to do is lock down @babel/core and any other Babel component you are working that is coercing @babel/types to go to 7.15.0

Here's the relevant section I had in my package.json

"@babel/core": "~7.14.0",
"@babel/compat-data": "~7.14.0",
"@babel/generator": "~7.14.0",
"@babel/helper-compilation-targets": "~7.14.0",
"@babel/helper-create-class-features-plugin": "~7.14.0",
"@babel/helper-create-regexp-features-plugin": "~7.14.0",
"@babel/helper-member-expression-to-functions": "~7.14.0",
"@babel/helper-module-transforms": "~7.14.0",
"@babel/helper-replace-supers": "~7.14.0",
"@babel/plugin-transform-react-display-name": "~7.14.0",
"@babel/plugin-transform-runtime": "~7.14.0",
"@babel/types": "~7.14.0",

Just replace all of that and perform an npm install and let it try to resolve and test your scenario again. If it still fails just look at package-lock.json and locate 7.15.0 and adjust the dependency accordingly

With this approach you don't need to "recover" from a zip file.

over 4 years ago · Santiago Trujillo Relatório

0

Pin @babel/plugin-transform-react-display-name to 7.14.5.

You can do it via adding this into your package.json if your package manager support resolutions.

  "resolutions": {
    "@babel/plugin-transform-react-display-name": "7.14.5"
  }

Thank to facebook/react-native#31960

over 4 years ago · Santiago Trujillo Relatório

0

the problem is due to a babel update that affected the RN project. copy @babel from some other project and paste in node_modules or Download the @babel folder from here and replace the existing folder in the node_modules.Babel Download

And run

npm start --reset-cache
over 4 years ago · Santiago Trujillo Relatório

0

I've had this come up when I change git branches and need to do a yarn install. I like the comment to change the bable version since I'm also on 7.15 and I'll try this the next time it occurs...

To get around this I have successfully:

  1. Stopped metro
  2. ran a cleanup script (included below)
  3. removed/uninstall app from device/simulator
  4. started metro
  5. installed app
  6. sometimes I still get the error and do 1-5 again and it works.

my cleanup script

#!/bin/bash

echo "clean'n android"
cd ./android && ./gradlew clean
cd ..

rm -rf ./node_modules
yarn cache clean
rm ./yarn.lock

rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/metro-builder-cache-*

yarn install

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda