SyntaxError in /node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.js
See original GitHub issueI’m getting this error:
error: bundling failed: SyntaxError in /Users/tommy/Git/noisolation/FamilyFrame/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.js: /$project_path/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.js: Unexpected token, expected { (18:7)
16 | import AnimatedNode from 'AnimatedNode';
17 |
> 18 | export opaque type StyleSheetStyle: number = number;
| ^
19 |
20 | export type ColorValue = null | string;
21 | export type DimensionValue = null | number | string | AnimatedNode;
My code:
import { Image as CachedImage } from 'react-native-expo-image-cache';
class Class extends Component {
render() {
const preview = require('./img/image.png');
const uri = this.props.imageURI;
return <CachedImage style={{ height: 100, width: 100 }} {...{ preview, uri }} />;
}
}
Anyone else experienced this?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
SyntaxError - JavaScript - MDN Web Docs
The SyntaxError object represents an error when trying to interpret syntactically invalid code. It is thrown when the JavaScript engine encounters tokens or ......
Read more >How to Handle the Syntax Error in Javascript - Rollbar
The Javascript SyntaxError is thrown when the engine comes across tokens or token orders with incorrect syntax when parsing code.
Read more >JavaScript file looks OK to me but getting a syntax error
It turns out the problem was the space in the string. As with @phix's comment, if I manually create the file there is...
Read more >SyntaxError - JavaScript: The Definitive Guide, 6th Edition [Book]
An instance of the SyntaxError class is thrown to signal a syntax error in JavaScript code. The eval() method, the Function() constructor, and...
Read more >JavaScript SyntaxError - Unexpected token - GeeksforGeeks
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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

@origamih This should be finally fixed now 😃
@wcandillon I had the same issue. I tried to strip away Flow myself, and this line of the
compiledcode caused the issue:import { } from "react-native/Libraries/StyleSheet/StyleSheetTypes";Obviously it stripped the flow annotation inside the import bracket, but the import statement remains, which caused babel to compile this file. I commented out this line and ta-da.