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

[BUG] Metro still can't build on windows #213

Closed
gengjiawen opened this issue Aug 2, 2018 · 6 comments
Closed

[BUG] Metro still can't build on windows #213

gengjiawen opened this issue Aug 2, 2018 · 6 comments

Comments

@gengjiawen
Copy link

gengjiawen commented Aug 2, 2018

Repro: Just build RNTester on windows.
Related issue: facebook/react-native#20353, #181.
From what I test, 0.42.1 works. But not 0.42.2, 0.43.1. 0.43.2., 0.43.3.
You can also see the appveyor build log: https://ci.appveyor.com/project/gengjiawen/react-native/build/1.0.22/job/it491en7tm6r69cq.

D:\Developer\react-native\local-cli\cliEntry.js:30
import type {CommandT} from './commands';
       ^^^^

SyntaxError: Unexpected identifier
    at new Script (vm.js:74:7)
    at createScript (vm.js:246:10)
    at Object.runInThisContext (vm.js:298:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Module._compile (D:\Developer\react-native\node_modules\pirates\lib\index.js:83:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.newLoader [as .js] (D:\Developer\react-native\node_modules\pirates\lib\index.js:88:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@rafeca
Copy link
Contributor

rafeca commented Aug 3, 2018

Thanks for the information @gengjiawen !

This means that we reintroduced the issue in one of the following commits: v0.42.1...v0.42.2

@pvdz The most probable thing that can be causing this issue is the upgrade to babel7-beta.54 + the revert of the windows dir normalization.

@gengjiawen can you test if v0.43.3 + a revert of 0b70c9a fixes the issue? if not can test it tomorrow (I'm in European time)

@gengjiawen
Copy link
Author

@rafeca is there an easy way I can test this. There are many packages in metro. And How do I replace the metro version in react native.

@rafeca
Copy link
Contributor

rafeca commented Aug 3, 2018

From what I test, 0.42.1 works. But not 0.42.2, 0.43.1. 0.43.2., 0.43.3.

uhm I'm confused now, how were you able to test that 0.42.1 works but not 0.42.2 without replacing the metro version in React Native?

@rafeca
Copy link
Contributor

rafeca commented Aug 3, 2018

It looks like the root issue comes from 0b70c9a, I'm reverting it and afterwards we're going to release a new version of Metro.

Thanks @gengjiawen for helping me debug it!

@rafeca
Copy link
Contributor

rafeca commented Aug 3, 2018

We've just published Metro v0.43.4 which should fix the windows issues: https://github.com/facebook/metro/releases/tag/v0.43.4

@rafeca rafeca closed this as completed Aug 3, 2018
@LinusU
Copy link
Contributor

LinusU commented Aug 6, 2018

is there an easy way I can test this.

Just for future reference, I personally used something like this to test with other versions:

"resolutions": {
  "**/buck-worker-tool": "0.43.4",
  "**/metro": "0.43.4",
  "**/metro-babel-register": "0.43.4",
  "**/metro-babel7-plugin-react-transform": "0.43.4",
  "**/metro-cache": "0.43.4",
  "**/metro-config": "0.43.4",
  "**/metro-core": "0.43.4",
  "**/metro-memory-fs": "0.43.4",
  "**/metro-minify-uglify": "0.43.4",
  "**/metro-react-native-babel-preset": "0.43.4",
  "**/metro-resolver": "0.43.4",
  "**/metro-source-map": "0.43.4",
}

Add that to your package.json, and then run yarn.

You can also use the following snippet to force a specific version of Babel:

"resolutions": {
  "**/@babel/code-frame": "7.0.0-beta.48",
  "**/@babel/core": "7.0.0-beta.48",
  "**/@babel/generator": "7.0.0-beta.48",
  "**/@babel/helper-annotate-as-pure": "7.0.0-beta.48",
  "**/@babel/helper-builder-binary-assignment-operator-visitor": "7.0.0-beta.48",
  "**/@babel/helper-builder-react-jsx": "7.0.0-beta.48",
  "**/@babel/helper-call-delegate": "7.0.0-beta.48",
  "**/@babel/helper-define-map": "7.0.0-beta.48",
  "**/@babel/helper-explode-assignable-expression": "7.0.0-beta.48",
  "**/@babel/helper-function-name": "7.0.0-beta.48",
  "**/@babel/helper-get-function-arity": "7.0.0-beta.48",
  "**/@babel/helper-hoist-variables": "7.0.0-beta.48",
  "**/@babel/helper-member-expression-to-functions": "7.0.0-beta.48",
  "**/@babel/helper-module-imports": "7.0.0-beta.48",
  "**/@babel/helper-module-transforms": "7.0.0-beta.48",
  "**/@babel/helper-optimise-call-expression": "7.0.0-beta.48",
  "**/@babel/helper-plugin-utils": "7.0.0-beta.48",
  "**/@babel/helper-regex": "7.0.0-beta.48",
  "**/@babel/helper-remap-async-to-generator": "7.0.0-beta.48",
  "**/@babel/helper-replace-supers": "7.0.0-beta.48",
  "**/@babel/helper-simple-access": "7.0.0-beta.48",
  "**/@babel/helper-split-export-declaration": "7.0.0-beta.48",
  "**/@babel/helper-wrap-function": "7.0.0-beta.48",
  "**/@babel/helpers": "7.0.0-beta.48",
  "**/@babel/highlight": "7.0.0-beta.48",
  "**/@babel/plugin-external-helpers": "7.0.0-beta.48",
  "**/@babel/plugin-proposal-class-properties": "7.0.0-beta.48",
  "**/@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.48",
  "**/@babel/plugin-proposal-optional-chaining": "7.0.0-beta.48",
  "**/@babel/plugin-syntax-class-properties": "7.0.0-beta.48",
  "**/@babel/plugin-syntax-dynamic-import": "7.0.0-beta.48",
  "**/@babel/plugin-syntax-flow": "7.0.0-beta.48",
  "**/@babel/plugin-syntax-jsx": "7.0.0-beta.48",
  "**/@babel/plugin-syntax-nullish-coalescing-operator": "7.0.0-beta.48",
  "**/@babel/plugin-syntax-object-rest-spread": "7.0.0-beta.48",
  "**/@babel/plugin-syntax-optional-chaining": "7.0.0-beta.48",
  "**/@babel/plugin-transform-arrow-functions": "7.0.0-beta.48",
  "**/@babel/plugin-transform-async-to-generator": "7.0.0-beta.48",
  "**/@babel/plugin-transform-block-scoping": "7.0.0-beta.48",
  "**/@babel/plugin-transform-classes": "7.0.0-beta.48",
  "**/@babel/plugin-transform-computed-properties": "7.0.0-beta.48",
  "**/@babel/plugin-transform-destructuring": "7.0.0-beta.48",
  "**/@babel/plugin-transform-exponentiation-operator": "7.0.0-beta.48",
  "**/@babel/plugin-transform-flow-strip-types": "7.0.0-beta.48",
  "**/@babel/plugin-transform-for-of": "7.0.0-beta.48",
  "**/@babel/plugin-transform-function-name": "7.0.0-beta.48",
  "**/@babel/plugin-transform-literals": "7.0.0-beta.48",
  "**/@babel/plugin-transform-modules-commonjs": "7.0.0-beta.48",
  "**/@babel/plugin-transform-object-assign": "7.0.0-beta.48",
  "**/@babel/plugin-transform-parameters": "7.0.0-beta.48",
  "**/@babel/plugin-transform-react-display-name": "7.0.0-beta.48",
  "**/@babel/plugin-transform-react-jsx": "7.0.0-beta.48",
  "**/@babel/plugin-transform-react-jsx-source": "7.0.0-beta.48",
  "**/@babel/plugin-transform-regenerator": "7.0.0-beta.48",
  "**/@babel/plugin-transform-shorthand-properties": "7.0.0-beta.48",
  "**/@babel/plugin-transform-spread": "7.0.0-beta.48",
  "**/@babel/plugin-transform-sticky-regex": "7.0.0-beta.48",
  "**/@babel/plugin-transform-template-literals": "7.0.0-beta.48",
  "**/@babel/plugin-transform-unicode-regex": "7.0.0-beta.48",
  "**/@babel/register": "7.0.0-beta.48",
  "**/@babel/template": "7.0.0-beta.48",
  "**/@babel/traverse": "7.0.0-beta.48",
  "**/@babel/types": "7.0.0-beta.48"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants