question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxError in /node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.js

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wcandilloncommented, Sep 6, 2018

@origamih This should be finally fixed now 😃

0reactions
origamihcommented, Aug 17, 2018

@wcandillon I had the same issue. I tried to strip away Flow myself, and this line of the compiled code 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found