WebStorm React Native无法启动调试

时间:2018-11-14 14:00:53

标签: react-native webstorm

启动调试会话时出现此错误。在JetBrains

之前和之后的设置中,我从未使用过WebStorm
"C:\Program Files\JetBrains\WebStorm 2018.2.6\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" --inspect-brk=51768 L:\react\PropertyFinder\PropertyFinder\index.js
Debugger listening on ws://127.0.0.1:51768/b33603e7-c88c-4336-b4d1-6042b064fcb0
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
L:\react\PropertyFinder\PropertyFinder\index.js:1
(function (exports, require, module, __filename, __dirname) { import {AppRegistry} from 'react-native';
                                                                     ^

SyntaxError: Unexpected token {
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:656:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
Waiting for the debugger to disconnect...

Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)

这是Index.js

/** @format */

    import {AppRegistry} from 'react-native';
    import App from './App';
    import {name as appName} from './app.json';

    AppRegistry.registerComponent(appName, () => App);

有什么主意吗? index.js:1似乎有问题,但是什么?

1 个答案:

答案 0 :(得分:2)

您应该使用React Native运行配置来启动应用程序-请参见Help instructionsblog post。  我不明白从{.1}开始使用Node.js

时要完成的工作