expo/expo-cli

SyntaxError: Unexpected token in exp.js

yawinop opened this issue · 1 comments

Summary

I get an error trying to run the baby steps on this. Just starting so new to this setup.

However, Looking the error and analysing the code changes a bit, I think i found where the issue is. I could be wrong.

I think the #4312 introduce a bug in exp,ts inside the asyncAction and asyncActionProjectDir. the line code numbers 337 and 447 lost the catch exception part from the previous file version. Not sure if it was a mistake or intentional.

Adding the catch (e) back should fix it.

Environment

command execution fails due to the bug. It's the latest code base.

Please specify your device/emulator/simulator platform, model and version

N/A

Error output

C:\Users\xxx\yy>npx expo -h
C:\Users\xxx\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js:424
} catch (err: any){}
^

SyntaxError: Unexpected token :
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:152:10)
at Module._compile (module.js:624:28)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\xxx\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js:20:1)

Reproducible demo or steps to reproduce from a blank project

Complete new install a blank project and try to run any of the npx commands.

Hi @yawinop! The expo-cli has been deprecated for some time now, in favor of the versioned CLI.

I think you are trying to run this new CLI through npx expo. But, because the expo-cli is still globally installed, you are still calling into this deprecated CLI. You could try running npm remove --global expo-cli, and running npx expo in your project.

Hope this helps!