2017-01-31 8 views
0

Ich bekomme diesen kryptischen Fehler in React Native. Versucht, meine Pakete mit npm neu zu installieren und meine eigene Codesyntax zu überprüfen, aber ohne Fortschritt.Babylon Syntaxfehler mit reagieren nativ

Das Konsolenprotokoll bezieht sich nur auf diese Datei: node_modules/babylon/lib/index.js

Was ist die wahrscheinliche Ursache und wie mehr Debug-Informationen über diesen Fehler zu bekommen?

~/ReactNativeProject/node_modules/react-native/packager ~ 
Scanning 576 folders for symlinks in /Users/user/ReactNativeProject/node_modules (15ms) 
┌────────────────────────────────────────────────────────────────────────────┐ 
│ Running packager on port 8081.           │ 
│                   │ 
│ Keep this packager running while developing on any JS projects. Feel  │ 
│ free to close this tab and run your own packager instance if you   │ 
│ prefer.                 │ 
│                   │ 
│ https://github.com/facebook/react-native         │ 
│                   │ 
└────────────────────────────────────────────────────────────────────────────┘ 
Looking for JS files in 
    /Users/user/ReactNativeProject 

[01/31/2017, 18:22:20] <START> Initializing Packager 
[01/31/2017, 18:22:20]   HMR Server listening on /hot 

React packager ready. 

[01/31/2017, 18:22:21] <START> Building Haste Map 
[01/31/2017, 18:22:21] <END> Building Haste Map (248ms) 
[01/31/2017, 18:22:21] <END> Initializing Packager (1083ms) 
[01/31/2017, 18:22:38] <START> Requesting bundle 
           bundle_url: /index.ios.bundle?platform=ios&dev=true&minify=false&hot=true 
[01/31/2017, 18:22:38] <START> Transforming files 
transformed 422/460 (92%)/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4336 
    throw err; 
^

SyntaxError: Unexpected token (23:1) 
    at Parser.pp$5.raise (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4333:13) 
    at Parser.pp.unexpected (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:1705:8) 
    at Parser.pp$3.parseIdentifier (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4211:10) 
    at Parser.pp$3.parsePropertyName (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4031:96) 
    at Parser.pp$3.parseObj (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3947:12) 
    at Parser.pp$3.parseExprAtom (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3639:19) 
    at Parser.pp$3.parseExprSubscripts (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3414:19) 
    at Parser.pp$3.parseMaybeUnary (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3394:19) 
    at Parser.pp$3.parseExprOps (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3324:19) 
    at Parser.pp$3.parseMaybeConditional (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3301:19) 
transformed 442/506 (87%)/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4336 
    throw err; 
^

SyntaxError: Unexpected token (23:1) 
    at Parser.pp$5.raise (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4333:13) 
    at Parser.pp.unexpected (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:1705:8) 
    at Parser.pp$3.parseIdentifier (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4211:10) 
    at Parser.pp$3.parsePropertyName (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4031:96) 
    at Parser.pp$3.parseObj (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3947:12) 
    at Parser.pp$3.parseExprAtom (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3639:19) 
    at Parser.pp$3.parseExprSubscripts (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3414:19) 
    at Parser.pp$3.parseMaybeUnary (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3394:19) 
    at Parser.pp$3.parseExprOps (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3324:19) 
    at Parser.pp$3.parseMaybeConditional (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3301:19) 
transformed 483/542 (89%)/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4336 
    throw err; 
^

SyntaxError: Unexpected token (23:1) 
    at Parser.pp$5.raise (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4333:13) 
    at Parser.pp.unexpected (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:1705:8) 
    at Parser.pp$3.parseIdentifier (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4211:10) 
    at Parser.pp$3.parsePropertyName (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:4031:96) 
    at Parser.pp$3.parseObj (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3947:12) 
    at Parser.pp$3.parseExprAtom (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3639:19) 
    at Parser.pp$3.parseExprSubscripts (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3414:19) 
    at Parser.pp$3.parseMaybeUnary (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3394:19) 
    at Parser.pp$3.parseExprOps (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3324:19) 
    at Parser.pp$3.parseMaybeConditional (/Users/user/ReactNativeProject/node_modules/babylon/lib/index.js:3301:19) 
transformed 691/694 (100%) 

Antwort

1

Das Problem war mit dem render() Verfahren eines der Reaktion Mutter Komponenten und die Verwendung eines Spread-Operator an der falschen Stelle,

render(){ 
    return (
     <View> 
     {...this.props.children} 
     </View> 
    ) 
    } 

musste

render(){ 
    return (
     <View> 
     {this.props.children} 
     </View> 
    ) 
    } 
geändert werden
Verwandte Themen