Unexpected token import, v0.56.0-rc cliEntry.js error
See original GitHub issueUsing the latest RN pr v0.56.0-rc When running ‘react-native run-android’, I get an error saying it doesn’t recognize the import command in clipEntry.js, line 30.
...\node_modules\react-native\local-cli\cliEntry.js:30
import type { CommandT } from './commands';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Module._compile (Y:\React-Native\trivia-mobile-n\node_modules\pirates\lib\index.js:91:24)
at Module._extensions..js (module.js:663:10)
at Object.newLoader [as .js] (Y:\React-Native\trivia-mobile-n\node_modules\pirates\lib\index.js:96:7)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
my devDependencies -
"devDependencies": {
"@babel/core": "^7.0.0-beta.49",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.0.1",
"babel-preset-react-native": "^5.0.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"fs-extra": "^4.0.2",
"jest": "22.0.6",
"react-test-renderer": "16.2.0",
"replace-in-file": "^3.0.0"
},
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Node error: SyntaxError: Unexpected token import
ES6 imports are a recently introduced feature and the current stable version of Node does not support them yet. Node.js issue tracker has...
Read more >import path from "node:path" - unexpected identifier - You.com
SyntaxError: Unexpected identifier at new Script (vm.js:80:7) at createScript (vm.js:274:10) at Object.runInThisContext (vm.js:326:10) at Module.
Read more >SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >Unexpected token import Node.js - Reactgo
In this tutorial, we are going to learn about how to resolve the unexpected token import error in Node.js. When we use es6...
Read more >JavaScript ES6 - How to fix Unexpected token import - YouTube
This video is a short explanation on how to fix the syntax error : " Unexpected Token Import "Hint: type="module"
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@hramos Please re-open this issue. Although the template is not provided, this is a major blocking issue for any react-native development on Windows, including react-native-windows apps.
This seems to be an issue with how babel 7 resolves paths on windows. There is some path seperator replacement in
https://github.com/facebook/metro/blob/master/packages/metro-babel-register/src/babel-register.js
. If you remove both occurences of.replace(/\\/g, '/')
the cliEntry error is gone. However, there seems to be an issue with haste module resolving on windows then.Might be a react-native issue, might be a metro issue or might be a babel issue. Anyways,
v0.56.0-rc
is broken on windows.