facebookarchive / react-360

Create amazing 360 and VR content using React
https://facebook.github.io/react-360
Other
8.73k stars 1.23k forks source link

[QUESTION] react-vr-cli installs old version #366

Closed jgwinner closed 7 years ago

jgwinner commented 7 years ago

Description

Not sure if this is a bug or just something that isn't working yet

Expected behavior

react-vr init should install version 2.0.0

Actual behavior

react-vr init installs 1.4.0 of react-vr and react-vr-web

Reproduction

I've installed react-vr, react-vr-web and ovrui to 2.0.0 I've installed the dependencies, all in global mode.

I use react-vr init to create a new React-VR app. The app is not the current version. I've checked the code in 'generate' in react and it has these lines:

  "dependencies": {
    "ovrui": "~1.4.0",
    "react": "~15.4.1",
    "react-native": "~0.42.0",
    "three": "^0.80.1",
    "react-vr": "~1.4.0",
    "react-vr-web": "~1.4.0"
  },

Solution

Update react-vr-cli\generators\package.json.generator.js to include the lines:

  "dependencies": {
    "ovrui": "~2.0.0",
    "react": "~16.0.0",
    "react-native": "~0.48.0",
    "three": "^0.80.1",
    "react-vr": "~2.0.0",
    "react-vr-web": "~2.0.0"
  },

PLEASE double check these versions; if I run npm list react-vr in the directory:

\AppData\Roaming\npm I get: ``` +-- UNMET PEER DEPENDENCY react@16.0.0 +-- UNMET PEER DEPENDENCY react-native@0.49.2 `-- react-vr@2.0.0 npm ERR! peer dep missing: react@16.0.0-beta.5, required by react-native@0.49.2 npm ERR! peer dep missing: react-native@~0.48.0, required by react-vr@2.0.0 npm ERR! peer dep missing: react-native@~0.48.0, required by react-vr-web@2.0.0 ``` That's why I marked this as a question, not a bug. I've tried re-issuing the -g installs, and I get these odd errors: ``` C:\Users\John>npm install react -g C:\Users\John\AppData\Roaming\npm `-- react@16.0.0 C:\Users\John>npm install react-native -g npm WARN deprecated connect@2.30.2: connect 2.x series is deprecated C:\Users\John\AppData\Roaming\npm\react-native -> C:\Users\John\AppData\Roaming\npm\node_modules\react-native\local-cli\wrong-reac t-native.js C:\Users\John\AppData\Roaming\npm +-- UNMET PEER DEPENDENCY react@16.0.0-beta.5 `-- react-native@0.49.2 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules\react-native\node_modules\sane\node_modules\fsevents ): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (curren t: {"os":"win32","arch":"x64"}) npm WARN react-native@0.49.2 requires a peer of react@16.0.0-beta.5 but none was installed. C:\Users\John>npm install react-vr -g C:\Users\John\AppData\Roaming\npm +-- UNMET PEER DEPENDENCY react@16.0.0 +-- UNMET PEER DEPENDENCY react-native@~0.48.0 `-- react-vr@2.0.0 npm WARN react-vr@2.0.0 requires a peer of react@16.0.0 but none was installed. npm WARN react-vr@2.0.0 requires a peer of react-native@~0.48.0 but none was installed. ``` ### Workaround I use the instructions in the notifications: > To upgrade your application: > 1. Delete your node_modules directory > 2. Open your package.json file > 3. Update react-vr, react-vr-web, and ovrui to "~2.0.0" > 4. Reinstall your dependencies with npm install or yarn > I install an app with: react-vr init MazeGame I then edit package.json I then run npm install I get this (emphasis mine). ``` F:\ReactVR\MazeGame>npm install MazeGame@0.0.1 F:\ReactVR\MazeGame +-- ovrui@2.0.0 | `-- three@0.87.1 **_+-- UNMET PEER DEPENDENCY react@15.4.2 +-- UNMET PEER DEPENDENCY react-native@0.42.3_** +-- react-vr@2.0.0 | +-- create-react-class@15.6.2 | `-- prop-types@15.6.0 `-- react-vr-web@2.0.0 `-- three-gltf2-loader@1.1.0 npm WARN react-vr@2.0.0 requires a peer of react@16.0.0 but none was installed. npm WARN react-vr@2.0.0 requires a peer of react-native@~0.48.0 but none was installed. npm WARN react-vr-web@2.0.0 requires a peer of react@16.0.0 but none was installed. npm WARN react-vr-web@2.0.0 requires a peer of react-native@~0.48.0 but none was installed. ``` I try running the "hello" created app but it doesn't seem to run. So, I edit package.json to include: ``` "react": "~16.0.0", "react-native": "~0.48.0", ``` and run npm install again. This time I get: ``` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules\jest-haste-map\node_modules\sane\node_modules\fseven ts): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (curren t: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules\metro-bundler\node_modules\sane\node_modules\fsevent s): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (curren t: {"os":"win32","arch":"x64"}) npm WARN react-native@0.48.4 requires a peer of react@16.0.0-alpha.12 but none was installed. npm WARN react-test-renderer@15.4.2 requires a peer of react@^15.4.2 but none was installed. ``` I then use 'npm start' and get this lovely error: [](> MazeGame@0.0.1 start F:\ReactVR\MazeGame > node -e "console.log('open browser at http://localhost:8081/vr/\n\n');" && node node_modules/react-native/local-cli/cli.js start open browser at http://localhost:8081/vr/ module.js:471 throw err; ^ Error: Cannot find module './node_modules/react-native/packager/blacklist' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (F:\ReactVR\MazeGame\rn-cli.config.js:4:17) at Module._compile (module.js:570:32) at Module._extensions..js (module.js:579:10) at Object.require.extensions.(anonymous function) [as .js] (F:\ReactVR\MazeGame\node_modules\babel-register\lib\node.js:152:7) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" npm ERR! node v6.11.0 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! MazeGame@0.0.1 start: `node -e "console.log('open browser at http://localhost:8081/vr/\n\n');" && node node_modules/react -native/local-cli/cli.js start` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the MazeGame@0.0.1 start script 'node -e "console.log('open browser at http://localhost:8081/vr/\n\n');" && nod e node_modules/react-native/local-cli/cli.js start'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the MazeGame package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node -e "console.log('open browser at http://localhost:8081/vr/\n\n');" && node node_modules/react-native/local-cli/c li.js start npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs MazeGame npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls MazeGame npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! F:\ReactVR\MazeGame\npm-debug.log) ### Additional Information * 'react-vr' package version: [FILL THIS OUT: get this by running `npm list react-vr`] +-- UNMET PEER DEPENDENCY react@16.0.0 `-- react-vr@2.0.0 npm ERR! peer dep missing: react@16.0.0-alpha.12, required by react-native@0.48.4 npm ERR! peer dep missing: react@^15.4.2, required by react-test-renderer@15.4.2 * 'react-vr-web' package version: [FILL THIS OUT: get this by running `npm list react-vr-web`] MazeGame@0.0.1 F:\ReactVR\MazeGame +-- UNMET PEER DEPENDENCY react@16.0.0 `-- react-vr-web@2.0.0 npm ERR! peer dep missing: react@16.0.0-alpha.12, required by react-native@0.48.4 npm ERR! peer dep missing: react@^15.4.2, required by react-test-renderer@15.4.2 * Operating System: [FILL THIS OUT: MacOS, Linux, or Windows?] Windows * Graphics Card: [FILL THIS OUT: NVIDA, ATI, Intel? Which Driver?] N/A (GTX 1070) * Browser: [FILL THIS OUT: Oculus Browser, Chrome, Edge, Safari? Which version?] Firefox Nightly (up to date as of ... last night) * VR Device: [FILL THIS OUT: In or Out of VR? Headset? ] Won't run.
andrewimm commented 7 years ago

What version of react-vr-cli are you running? If you're out of date, it should print a red error message saying "Current CLI version is 0.3.5, but the latest available version is 0.3.6" every time you run it.

This has already been updated in the latest CLI, here's the current contents of the latest package: https://unpkg.com/react-vr-cli@0.3.6/generators/package.json.generator.js

We can't automatically update your CLI generator for you due to the way npm / yarn work, so the best we can do is query npm, check if you have the latest version of the CLI, and print an error message if you don't with instructions on how to update.

andrewimm commented 7 years ago

You are right that the update instructions for existing apps need to include react and react-native as well. I've fixed that on the release.

jgwinner commented 7 years ago

Ouch - never noticed that error. I think it scrolled by, but I should have noticed it at the start. Sorry for that!

Updated! Whoo Hoo! That worked, I'm on 2.0.0

There are a few other differences in the CLI generated 2.0 and manually updated. I think the problem might have been in the dev-dependencies. I'll do some more testing on a manual upgrade.

Manually updated:

  "dependencies": {
    "ovrui": "~2.0.0",
    "react": "~16.0.0",
    "react-native": "~0.48.0",
    "three": "^0.80.1",
    "react-vr": "~2.0.0",
    "react-vr-web": "~2.0.0"
  },
  "devDependencies": {
    "babel-jest": "^19.0.0",
    "babel-preset-react-native": "^1.9.1",
    "jest": "^19.0.2",
    "react-devtools": "^2.1.3",
    "react-test-renderer": "~15.4.1",
    "xopen": "1.0.0"
  },

CLI generated:

  "dependencies": {
    "ovrui": "~2.0.0",
    "react": "16.0.0",
    "react-native": "~0.48.0",
    "three": "^0.87.0",
    "react-vr": "~2.0.0",
    "react-vr-web": "~2.0.0"
  },
  "devDependencies": {
    "babel-jest": "^19.0.0",
    "babel-preset-react-native": "^1.9.1",
    "jest": "^19.0.2",
    "react-devtools": "^2.5.2",
    "react-test-renderer": "16.0.0",
    "xopen": "1.0.0"
  },

When I generate an app, I did notice this:

+-- UNMET PEER DEPENDENCY react@16.0.0

If I run npm install in the generated 2.0.0 directory (with the updated CLI) I get errors, but it does run:

MazeGame200@0.0.1 F:\ReactVR\MazeGame200
+-- UNMET PEER DEPENDENCY react@16.0.0
`-- react-native@0.48.4
  +-- babel-preset-react-native@2.1.0
  `-- metro-bundler@0.11.0
    `-- babel-preset-react-native@2.1.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules\jest-haste-map\node_modules\sane\node_modules\fseven
ts):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (curren
t: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules\metro-bundler\node_modules\sane\node_modules\fsevent
s):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (curren
t: {"os":"win32","arch":"x64"})
npm WARN react-native@0.48.4 requires a peer of react@16.0.0-alpha.12 but none was installed.
jgwinner commented 7 years ago

If I check the version of react in the react-vr-cli generated version, I get an error (but it does run!)

MazeGame200@0.0.1 F:\ReactVR\MazeGame200
`-- UNMET PEER DEPENDENCY react@16.0.0

npm ERR! peer dep missing: react@16.0.0-alpha.12, required by react-native@0.48.4
npm ERR! code 1

If I manually check node_modules\react, it seems to be:

"version": "16.0.0"

andrewimm commented 7 years ago

^^ That's a React Native issue, not something we can control. The error shouldn't actually prevent installing dependencies, though

jgwinner commented 7 years ago

I hear you. Should I open a bug there?

== John ==

andrewimm commented 7 years ago

No point, it's just a configuration annoyance that's resolved in 0.49. We'll make that upgrade in a couple weeks, it just requires a significant overhaul of our Animated implementation that I'm working on now.

jgwinner commented 7 years ago

That sounds interesting!

Ok, got it, thanks for taking a look.

== John ==

andrewimm commented 7 years ago

Added all updates to release notes, closing since there is no issue with the CLI