Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token "{". Import call expects exactly one argument #25545

Closed
canyavall opened this issue Jul 8, 2019 · 5 comments
Closed

Unexpected token "{". Import call expects exactly one argument #25545

canyavall opened this issue Jul 8, 2019 · 5 comments
Labels
Bug Resolution: Locked This issue was locked by the bot.

Comments

@canyavall
Copy link

canyavall commented Jul 8, 2019

One week ago everything was working perfectly fine. I came back from holidays and pulled all new code from my coleagues. Executed yarn run-android and I got this message:

Unexpected token "{". Import call expects exactly one argument

I thought, ok, maybe some code from my coleagues broke it so I create a branch from the last working state and nothing, same issue...

Since then (2days) I've been trying everything that came to my mind (gradlew clear, clean cache from yarn and npm, remove node_modules (a lot of times)... and nothing works...

One thing that's strange is the metro bundler path:
image

React Native version:
React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
Memory: 5.85 GB / 15.88 GB
Binaries:
Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.3.0.0 AI-182.5107.16.33.5264788

Steps To Reproduce

1.Just run react-native run-android and done...

Snack, code example, or link to a repository: I really don't know which code paste as it really breaks before bundling...

@canyavall canyavall added the Bug label Jul 8, 2019
@canyavall
Copy link
Author

I kept investigating and, incredibly, if in the index.js between the imports I write a console.log

import {AppRegistry} from 'react-native';
console.log("Yeaaaaahhhh")
import AppNative from './native/App.native';

Then it works.....

If I remove it, then it stops working....

@canyavall
Copy link
Author

So, for what I can see, the babel.config.js file is not being loaded on time in windows10, so the transpile is not taking place...

@canyavall
Copy link
Author

Doing wha tthis link say: https://medium.com/@abhisheknalwaya/how-to-clear-react-native-cache-c435c258834e and deleting the yarn.lock fixed it

@wuweijian1997
Copy link

nice。
I solved the problem with this line of code.
`
cd android &&

./gradlew cleanBuildCache
`

windows & android

@arjndr
Copy link

arjndr commented Jun 21, 2020

for anyone that's stuck yarn start --reset-cache will do the trick

@facebook facebook locked as resolved and limited conversation to collaborators Oct 10, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants