2017-04-19 84 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,你應該很好去。