2017-04-19 76 views
3




我试图使用与Visual Studio代码(应该是最好的)的React Native,但它给我一个错误,当我尝试调试。
我已经安装了React Native Tools扩展,但是当我尝试启动(F5)时,它返回“[Error] Could not debug。sure that the reactive-native npm package is root on root?”
我也尝试发送F1“> React Native:Run Android”的命令,但它返回错误“当前工作区不是React Native项目”。

我使用的是Ubuntu 16.04 LTS。
Visual Studio代码1.11.2
反应母语-CLI:2.0.1
反应母语:0.43.3反应与Visual Studio的本机调试代码不工作

有任何影响您使用Visual Studio代码?你有这些问题吗?

我launch.json(从扩展生成的唯一文件阵营本地工具)

{ 
    "version": "0.2.0", 
    "configurations": [ 
     { 
      "name": "Debug Android", 
      "program": "${workspaceRoot}/.vscode/launchReactNative.js", 
      "type": "reactnative", 
      "request": "launch", 
      "platform": "android", 
      "sourceMaps": true, 
      "outDir": "${workspaceRoot}/.vscode/.react" 
     }, 
     { 
      "name": "Debug iOS", 
      "program": "${workspaceRoot}/.vscode/launchReactNative.js", 
      "type": "reactnative", 
      "request": "launch", 
      "platform": "ios", 
      "target": "iPhone 5s", 
      "sourceMaps": true, 
      "outDir": "${workspaceRoot}/.vscode/.react" 
     }, 
     { 
      "name": "Attach to packager", 
      "program": "${workspaceRoot}/.vscode/launchReactNative.js", 
      "type": "reactnative", 
      "request": "attach", 
      "sourceMaps": true, 
      "outDir": "${workspaceRoot}/.vscode/.react" 
     }, 
     { 
      "name": "Debug in Exponent", 
      "program": "${workspaceRoot}/.vscode/launchReactNative.js", 
      "type": "reactnative", 
      "request": "launch", 
      "platform": "exponent", 
      "sourceMaps": true, 
      "outDir": "${workspaceRoot}/.vscode/.react" 
     } 
    ] 
} 
+0

对于那些遇到问题的人,我开始使用Atom并安装了Nuclide – Riccardo

回答

0

我想这个答案是一点点晚了。

你的问题是,vscode找不到PATH引用的react-native。

如果您使用NPM尝试以下方法安装它:

NPM安装反应母语--global

这应该在你的路径安装。重新启动vscode,你应该很好去。