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

react-native cli tool syntax error on windows 10 #10033

Closed
josetapadas opened this issue Sep 21, 2016 · 14 comments
Closed

react-native cli tool syntax error on windows 10 #10033

josetapadas opened this issue Sep 21, 2016 · 14 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@josetapadas
Copy link

Issue Description

When trying to run 'react-native' from a windows 10 machine it returns a syntax error:

C:\Users\josetapadas\githubissue\node_modules\react-native\packager\react-packager\src\node-haste\index.js:40
  constructor({
              ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Module._extensions..js (module.js:416:10)
    at Object.require.extensions.(anonymous function) [as .js] (C:\Users\José Alves\src\AwesomeProject\node_modules\react-native\node_modules\babel-register\lib\node.js:154:7)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\Users\José Alves\src\AwesomeProject\node_modules\react-native\local-cli\server\util/attachHMRServer.js:11:34)
    at Module._compile (module.js:409:26)

Steps to Reproduce / Code Snippets

npm install -g react-native-cli
react-native

Additional Information

  • React Native version:
react-native-cli: 1.0.0
react-native: 0.33.0
node: v4.4.6
  • Operating System (macOS, Linux, or Windows?): Windows 10

Thank you!

@hramos
Copy link
Contributor

hramos commented Sep 21, 2016

Thanks for your question!

We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of React Native.

Questions like yours deserve a purpose-built Q&A forum. Would you like to post this question to Stack Overflow with the tag #react-native? We'll be happy to answer there. Post a link to your Stack Overflow question here, so that we don't lose track of it.

@hramos hramos closed this as completed Sep 21, 2016
@josetapadas
Copy link
Author

Hello @hramos,

Thank you for your quick reply!

I've then posted the question on SO:
http://stackoverflow.com/questions/39632926/react-native-cli-tool-syntax-error-on-windows-10

I'll be then waiting to understand what was the problem and the possible solution.

Thank you for your support, and time, on this issue.

@localhosted
Copy link

I have the same problem.

@josetapadas
Copy link
Author

Yep, me too still.. And no answer whatsoever on SO :( 👎

@hramos hramos reopened this Sep 26, 2016
@localhosted
Copy link

Using Windows bash everything installs fine, but then trying to run on Windows gives a similar error:

D:\Projects\ReactNative\node_modules\react-native\packager\react-packager\src\node-haste\index.js:100
    );
    ^
SyntaxError: Unexpected token )
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Module._extensions..js (module.js:565:10)
    at Object.require.extensions.(anonymous function) [as .js] (D:\Projects\ReactNative\node_modules\babel-register
\lib\node.js:154:7)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\Projects\ReactNative\node_modules\react-native\local-cli\server\util/attachHMRServer.
js:11:34)

Seems like someone else has a similar issue: https://stackoverflow.com/questions/37622492/react-native-syntaxerror-unexpected-token

It's unfortunate, I need to make a mockup app before friday, I'll probably have to go with Xamarin now.

@localhosted
Copy link

I ran react-native init again and this time it worked. Very mystical. o.O

@josetapadas
Copy link
Author

not for me..

@rozele
Copy link
Contributor

rozele commented Sep 28, 2016

I was just able to reproduce this easily by creating a directory with a non-ascii character (e.g., c:\šrc) and running react-native init there. Going to try debugging a bit further to see what the issue is, from the stack trace seems to be related to babel. Also confirmed that running react-native init in a path without these kinds of special characters works okay (e.g., c:\foo).

@rozele
Copy link
Contributor

rozele commented Sep 28, 2016

My best hypothesis at this point is that the babel registration is not recognizing that the path for .\packager\react-packager\src\node-haste\index.js falls under the registration here:
https://github.com/facebook/react-native/blob/master/local-cli/cli.js#L18
for the require call here:
https://github.com/facebook/react-native/blob/master/local-cli/server/util/attachHMRServer.js#L11

@oargaruna
Copy link

This is reproducible on OSX as well.

@localhosted
Copy link

I originally had a ç in my path name when I first installed react-native, might have been the issue even after I removed it.

@rozele
Copy link
Contributor

rozele commented Oct 5, 2016

@oargaruna not sure why this would be a problem on OSX, as the paths should already be "normal"

@oargaruna
Copy link

@rozele Frankly I don't know why this started happening on OSX. It was very strange.

@lacker
Copy link
Contributor

lacker commented Oct 25, 2016

The repro steps don't reproduce the bug for me, in the sense that I am in fact able to run React Native on windows 10. It sounds like there are some similar problems on this issue, like the ones with non-ascii characters, but those aren't the initial rationale behind this issue so this issue is kind of not the right place to resolve it. #10154 still seems like a good thing to close out in order to be sure we get the Babel upgrades, and perhaps that will resolve everything, but either way I am going to close this issue in lieu of the more specific ones. Please feel free to open a new issue if people have more specific issues in terms of which environments or situation installation on windows does not work for them.

@lacker lacker closed this as completed Oct 25, 2016
@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants