首页 文章

启动画面后本机应用程序崩溃

提问于
浏览
0

我是React Native的新手 . 我在Expo XDE中创建了一个新的空白项目,当我试图在我的Android设备上运行它时,每次它在启动画面后崩溃 . 这只是一个简单的空白应用程序 .

没有日志或错误 . Expo应用程序只返回第一页 .

设备:Android 7

XDE:世博会版本2.21.00

app.js

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Updated

npm start log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Pfn\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@5.5.1
3 info using node@v6.11.3
4 verbose stack Error: missing script: start
4 verbose stack     at run (C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\lib\run-script.js:151:19)
4 verbose stack     at C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\lib\run-script.js:61:5
4 verbose stack     at C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:115:5
4 verbose stack     at C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:402:5
4 verbose stack     at checkBinReferences_ (C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:357:45)
4 verbose stack     at final (C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:400:3)
4 verbose stack     at then (C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:160:5)
4 verbose stack     at ReadFileContext.<anonymous> (C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:332:20)
4 verbose stack     at ReadFileContext.callback (C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
4 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:367:13)
5 verbose cwd F:\react\my-new-project
6 verbose Windows_NT 10.0.15063
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Pfn\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
8 verbose node v6.11.3
9 verbose npm  v5.5.1
10 error missing script: start
11 verbose exit [ 1, true ]

添加后:

"scripts": {
    "start": "node app.js"
  }

package.json 日志:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Pfn\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@5.5.1
3 info using node@v6.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle my-new-project@0.0.0~prestart: my-new-project@0.0.0
6 info lifecycle my-new-project@0.0.0~start: my-new-project@0.0.0
7 verbose lifecycle my-new-project@0.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle my-new-project@0.0.0~start: PATH: C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;F:\react\my-new-project\node_modules\.bin;C:\Program Files\Expo XDE\resources\app\node_modules\xdl\binaries\windows\adb;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Smart Projects\IsoBuster;C:\Program Files\PuTTY\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Users\Pfn\AppData\Roaming\npm;C:\Users\Pfn\AppData\Local\Microsoft\WindowsApps;C:\Users\Pfn\AppData\Roaming\Composer\vendor\bin;C:\Users\Pfn\AppData\Roaming\npm
9 verbose lifecycle my-new-project@0.0.0~start: CWD: F:\react\my-new-project
10 silly lifecycle my-new-project@0.0.0~start: Args: [ '/d /s /c', 'node app.js' ]
11 silly lifecycle my-new-project@0.0.0~start: Returned: code: 1  signal: null
12 info lifecycle my-new-project@0.0.0~start: Failed to exec start script
13 verbose stack Error: my-new-project@0.0.0 start: `node app.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at EventEmitter.emit (events.js:191:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\Pfn\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:920:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid my-new-project@0.0.0
15 verbose cwd F:\react\my-new-project
16 verbose Windows_NT 10.0.15063
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Pfn\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v6.11.3
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error my-new-project@0.0.0 start: `node app.js`
22 error Exit status 1
23 error Failed at the my-new-project@0.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

UPDATE2:

npm安装警告:

npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none is installed. You must install peer dependencies yourself.
 npm WARN react-native-gesture-handler@1.0.0-alpha.28 requires a peer of react@> 15.0.0 but none is installed. You must install peer dependencies yourself.
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sshpk@1.13.0 (node_modules\fsevents\node_modules\sshpk):
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename 'F:\react\my-new-project\node_modules\fsevents\node_modules\sshpk' -> 'F:\react\my-new-project\node_modules\fsevents\node_modules\.sshpk.DELETE'

 added 5 packages and updated 2 packages in 70.53s

1 回答

  • 0

    哪个OS? Mac,Win还是Linux?如果您使用的是Linux,是否使用此命令打开了XDE客户端?

    On Linux, open with chmod a+x xde*.AppImage and ./xde*.AppImage
    

    无论你的操作系统如何,你确定你有......

    在黑暗中拍摄,但是一旦你更新了上面的内容,我就会开始一个新项目,然后再试一次 .

    UPDATE: 仔细查看您的日志,我可以看到您正确设置了're on Windows since the paths are 721858 , so ignore the linux comment above. I still think your environment isn' t . 重新安装节点和/或监视器可能会有所帮助(很可能是节点) . 您也可以尝试安装纱线,看看是否有所作为 . 有时它对我有用 .

相关问题