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

Creating new project fails #12542

Closed
jeroenbourgois opened this issue Feb 23, 2017 · 54 comments
Closed

Creating new project fails #12542

jeroenbourgois opened this issue Feb 23, 2017 · 54 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jeroenbourgois
Copy link

Description

I did a fresh install following the instructions on https://facebook.github.io/react-native/docs/getting-started.html#content, but it fails at the first step:

react-native init AwesomeProject

This results in this output (the packages are installed properly with yarn):

├─ yargs-parser@4.2.1
└─ yargs@6.6.0
✨  Done in 5.86s.
/private/tmp/test/AwesomeProject/node_modules/babel-core/lib/transformation/file/index.js:600
      throw err;
      ^

SyntaxError: /private/tmp/test/AwesomeProject/node_modules/react-native/packager/react-packager/src/node-haste/index.js: You can only use Class Properties when the 'classProperties' plugin is enabled. (389:2)
  387 |   }
  388 |
> 389 |   static Cache;
      |   ^
  390 |   static Module;
  391 |   static Polyfill;
  392 |   static getAssetDataFromName;
    at Parser.pp$5.raise (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:4380:13)
    at Parser.pp$1.parseClassProperty (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:2508:10)
    at Parser.parseClassProperty (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:5947:20)
    at Parser.pp$1.parseClassBody (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:2424:34)
    at Parser.pp$1.parseClass (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:2361:8)
    at Parser.pp$1.parseStatement (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:1798:19)
    at Parser.parseStatement (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:5719:22)
    at Parser.pp$1.parseBlockBody (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:2223:21)
    at Parser.pp$1.parseTopLevel (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:1733:8)
    at Parser.parse (/private/tmp/test/AwesomeProject/node_modules/babylon/lib/index.js:1628:17)

Additional Information

I first thought it was a node problem so I reverted from 7.6.0 to the 6.10.0 LTS version, same result.

  • React Native version: ->
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
  • Platform: both
  • Operating System: MacOS
@kafkadev
Copy link

+1

2 similar comments
@odemolliens
Copy link

+1

@Kraignos
Copy link

+1

@jmz331
Copy link

jmz331 commented Feb 23, 2017

+1 same problem.

@UtkarshPramodGupta
Copy link

+1

5 similar comments
@kumarpatel
Copy link

+1

@aliuspetraska
Copy link

+1

@BuiTruongXuan
Copy link

+1

@simonjk
Copy link

simonjk commented Feb 23, 2017

+1

@zphhhhh
Copy link

zphhhhh commented Feb 23, 2017

+1

@marcosiino
Copy link

Lol, i'm just trying ReactNative now, and saw this strange error...so i've found this. Perfect timing! :) Btw, since i'm a beginner in ReactNative (just trying it now), how can i install the previous version of the cli which is not affect by this bug, using brew on mac, so that in the meanwhile i can try it ? (i've already installed the last cli, so i don't know if i first need to remove it). Someone can help me? Thanks!

@nikolay-radkov
Copy link

+1

@idancali
Copy link

+5 (the entire team is frustrated)

@bluedusk
Copy link

+1

2 similar comments
@agenciafera
Copy link

+1

@KaanErkol
Copy link

+1

@aliuspetraska
Copy link

@grabbou please take a look

@TheBlackHacker
Copy link

+1

@simonjk
Copy link

simonjk commented Feb 23, 2017

This change was done on the file in question 3h ago so it should be the primary suspect:
4a4dddb

@gmh04
Copy link

gmh04 commented Feb 23, 2017

+1

2 similar comments
@gamer496
Copy link

+1

@vaxo-m
Copy link

vaxo-m commented Feb 23, 2017

+1

@idancali
Copy link

idancali commented Feb 23, 2017

Found the bug people. Babylon (6.16.0 published an hour ago) messed something up. If you use 6.15.0 it works.

So if you just add this to your dependencies in your package.json file, you're good to go.

"babylon": "6.15.0"

@grabbou
Copy link
Contributor

grabbou commented Feb 23, 2017

Thanks, will let the team know we got a problem.

Follow: https://twitter.com/grabbou/status/834770049382629377

@kumarpatel
Copy link

npm uninstall babylon && npm install babylon@6.15.0

@craigedmunds
Copy link

+1

1 similar comment
@carlosroberto555
Copy link

+1

@MoOx
Copy link
Contributor

MoOx commented Feb 23, 2017

Stop +1 noise. Thanks.

@shmakovdima
Copy link

+1

@sunruh
Copy link

sunruh commented Feb 23, 2017

@hzoo I suspect it to come from PR babel/babylon#300

The changelog states

Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) (Andrew Levine)

Ensure that you enable the classProperties plugin in order to enable correct parsing of class properties. Prior to this version it was possible to parse them by enabling the flow plugin but this was not intended the behaviour.

If you enable the flow plugin you can only define the type of the class properties, but not initialize them.

@hzoo
Copy link
Contributor

hzoo commented Feb 23, 2017

Awesome, need to figure out what react-native is doing

@gelashviligiorgi
Copy link

+1

@markudevelop
Copy link

markudevelop commented Feb 23, 2017

@kumarpatel doesn't seems to work for me any other ideas for temp fix?

@diegorodriguesvieira
Copy link

+1

@codelinter
Copy link

Operating System: Windows 10 64bit

@chapati23
Copy link

temp fix possibly forking react-native and restraining babylon version to 6.15 in the 2 package.json's?

"babylon": "^6.14.1",

"babylon": "^6.14.1",

@simonjk
Copy link

simonjk commented Feb 23, 2017

was there any change. it is working now for me including babylon 6.16
$ npm list | grep react-native
├─┬ babel-preset-react-native@1.9.1
├─┬ react-native@0.41.2
$ npm list | grep babylon
│ ├── babylon@6.16.0

@chapati23
Copy link

interesting, what os / node / react-native-cli versions @simonjk ?

@hzoo
Copy link
Contributor

hzoo commented Feb 23, 2017

Yes the workaround should be to pin to babylon@6.15.0

Ok I have to work, so going to revert the 2 PRs and do a patch.

EDIT: Interesting how many people rely on Babel without any full time people working on it

@dfischer
Copy link
Contributor

dfischer commented Feb 23, 2017

(sorry for OT) Well, if there's one thing to say it's interesting (and awesome) to see how many people are trying to get up and running with a tutorial and at the frequency. I just ran into this too. 👍 thanks for the quick response @hzoo

@rizwanahmed19
Copy link

+1

@hzoo
Copy link
Contributor

hzoo commented Feb 23, 2017

Yeah @dfischer, I'm really sorry this is the experience people get when starting out with react-native/javascript/open source. We make mistakes

@dfischer
Copy link
Contributor

It's all good, I think it's cool how many people are reporting in. Good work @hzoo you rock!

@robdonn
Copy link

robdonn commented Feb 23, 2017

@hzoo Actually I think this is a really good experience for new people because it shows how quickly a problem can get resolved in a well supported project.

@hzoo
Copy link
Contributor

hzoo commented Feb 23, 2017

Releasing v6.16.1 until we actually can get the time to figure this out.

Ok made a new patch release that just reverts the PRs that caused the issues.

If you need to you'll need to rm -rf node_modules and npm install again. You don't need to add babylon to dependencies if you did before if this fixes it.

report back if it's fixed*

@futurechallenger
Copy link

cool! @hzoo

@zyhou
Copy link

zyhou commented Feb 23, 2017

Good for me, it's work :)

Thanks @hzoo

@RemoteCTO
Copy link

🎉 - Back in business!

Using yarn v0.20.3
Installing react-native...
...
...
✨  Done in 9.76s.
To run your app on iOS:
...

@kafkadev
Copy link

Thanks @hzoo

@sunruh
Copy link

sunruh commented Feb 23, 2017

@simonjk @chapati23 If the haste map has been generated once with a babylon version that's working and no change requires regeneration, it keeps workng even if you upgrade babylon again.

@simonjk
Copy link

simonjk commented Feb 23, 2017

@chapati23 MacOS 10.11.6

react-native --version
react-native-cli: 2.0.1
react-native: 0.41.2

node --version
v7.4.0

had the problem first too but after a rm of the folder and a re-init it the problem was suddenly gone

@jeroenbourgois
Copy link
Author

@hzoo @grabbou and everyone involved: thanks! Amazing how fast this was resolved!

@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.