Я попытался запустить реактивный симулятор.
Однако эта ошибка появилась в симуляторе:
Failed to load bundle(http://localhost:8081/index.bundle?
platform=ios&dev=true&minify=false)
with error:(/Users/sugawarasyuta/Desktop/albums/index.js:
Cannot read property 'bindings' of null(null))
Я дважды проверил свой синтаксис кода. Но я чувствую, что это не об этом. Вы знаете, как решить эту ошибку?
Вот мои файлы:
index.js
import React from 'react';
import { AppRegistry,View } from 'react-native';
import Header from './src/components/header';
import AlbumList from './src/components/AlbumList';
//Create a component
const App = () => (
<View>
<Header headerText= {'albums'} />
<AlbumList />
</View>
);
AppRegistry.registerComponent('albums', () => App );
AlbumList.js
import React,{Component}from 'react';
import {View, Text} from 'react-native';
import axios from 'axios';
class AlbumList extends Component {
componentWillMount(){
axios.get('https://rallycoding.herokuapp.com/api/music_albums')
.then(response => console.log(response));
}
render(){
return(
<View>
<Text>AlbumList!!!</Text>
</View>
);
}
}
export default AlbumList;
Это терминальные утверждения:
/usr/bin/codesign --force --sign - --entitlements /Users/sugawarasyuta/Desktop/albums/ios/build/Build/Intermediates.noindex/albums.build/Debug-iphonesimulator/albums.build/albums.app.xcent --timestamp=none /Users/sugawarasyuta/Desktop/albums/ios/build/Build/Products/Debug-iphonesimulator/albums.app
/Users/sugawarasyuta/Desktop/albums/ios/build/Build/Products/Debug-iphonesimulator/albums.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
** BUILD FAILED **
The following build commands failed:
CodeSign build/Build/Products/Debug-iphonesimulator/albums.app
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/albums.app
Launching org.reactjs.native.example.albums
org.reactjs.native.example.albums: 8385
Это мой package.json
. Правильны ли эти зависимости?
{
"name": "albums",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"axios": "^0.18.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"react": "16.3.1",
"react-native": "^0.56.0"
},
"devDependencies": {
"@babel/preset-env": "^7.0.0-beta.53",
"babel-jest": "23.0.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react-native": "4.0.0",
"eslint-config-rallycoding": "^3.2.0",
"jest": "23.1.0",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
Я обновил "babel-preset-react-native"
с "4.0.0"
до "^5.0.1"
и появилась еще одна ошибка:
error: bundling failed: SyntaxError:
/Users/sugawarasyuta/Desktop/albums/index.js: Unexpected token (11:3)
10 | const App = () => {
> 11 | <Header headerText= {'albums'} />
| ^
12 |
13 | };
at Parser.raise
(/Users/sugawarasyuta/Desktop/albums/node_modules
/@babel/core/node_modules/babylon/lib/index.js:776:15)
at Parser.unexpected
(/Users/sugawarasyuta/Desktop/albums/node_modules/
@babel/core/node_modules/babylon/lib/index.js:2079:16)
at Parser.parseExprAtom (/Users/sugawarasyuta/Desktop/albums/node_modules/@babel/core/node_modules/babylon/lib/index.js:3157:20)
at Parser.parseExprSubscripts (/Users/sugawarasyuta/Desktop/albums/node_modules/@babel/core/node_modules/babylon/lib/index.js:2757:21)
at Parser.parseMaybeUnary (/Users/sugawarasyuta/Desktop/albums/node_modules/@babel/core/node_modules/babylon/lib/index.js:2736:21)
at Parser.parseExprOps (/Users/sugawarasyuta/Desktop/albums/node_modules/@babel/core/node_modules/babylon/lib/index.js:2643:21)
at Parser.parseMaybeConditional (/Users/sugawarasyuta/Desktop/albums/node_modules/@babel/core/node_modules/babylon/lib/index.js:2615:21)
at Parser.parseMaybeAssign (/Users/sugawarasyuta/Desktop/albums/node_modules/@babel/core/node_modules/babylon/lib/index.js:2562:21)
at Parser.parseExpression (/Users/sugawarasyuta/Desktop/albums/node_modules/@babel/core/node_modules/babylon/lib/index.js:2515:21)
at Parser.parseStatementContent (/Users/sugawarasyuta/Desktop/albums/node_modules/@babel/core/node_modules/babylon/lib/index.js:4076:21)
BUNDLE [ios, dev] ../../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.
Я чувствую, что это происходит не из-за синтаксической ошибки, а из-за зависимости. Знаете ли вы, как я могу это исправить?