React native command palette doesn't work.
Actual Behavior
- Current Workspace is not a React Native project.
Expected Behavior
- Expect react native to run on android simulator.
Software versions
- React-Native VS Code extension version: 0.6.13
- VSCode version: 1.25.1
- OS platform and version: Ubuntu 16.04
- NodeJS version: 10.4.0
- React Native version: 0.56.0
- Expo SDK version (include if relevant):
Outputs (Include if relevant)
- (View -> Output):
[Error] Failed to start the React Native packager
Stack: Error: Failed to start the React Native packager: Current workspace is not a React Native project.
at Function.getWrappedError (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/error/internalError.js:35:16)
at Function.wrapError (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/error/errorHelper.js:18:44)
at resultOfCode.done.reason (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/entryPointHandler.js:43:72)
at _rejected (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:844:24)
at /home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:870:30
at Promise.when (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:788:41)
at /home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:604:44
at runSingle (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:137:13)
at flush (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
[Error] Failed to run the application in Android
Stack: Error: Failed to run the application in Android: Current workspace is not a React Native project.
at Function.getWrappedError (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/error/internalError.js:35:16)
at Function.wrapError (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/error/errorHelper.js:18:44)
at resultOfCode.done.reason (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/entryPointHandler.js:43:72)
at _rejected (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:844:24)
at /home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:870:30
at Promise.when (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:788:41)
at /home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:604:44
at runSingle (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:137:13)
at flush (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
[Error] Failed to run the application in Android
Stack: Error: Failed to run the application in Android: Current workspace is not a React Native project.
at Function.getWrappedError (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/error/internalError.js:35:16)
at Function.wrapError (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/error/errorHelper.js:18:44)
at resultOfCode.done.reason (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/entryPointHandler.js:43:72)
at _rejected (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:844:24)
at /home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:870:30
at Promise.when (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:788:41)
at /home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:604:44
at runSingle (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:137:13)
at flush (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
- Output (Developer Tools Console)
notificationsAlerts.ts:40 Error: Current workspace is not a React Native project.
at Function.selectProject (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/extension/commandPaletteHandler.js:283:29)
at Function.runAndroid (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/extension/commandPaletteHandler.js:87:21)
at registerVSCodeCommand (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/extension/rn-extension.js:160:215)
at generator.time (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/telemetryHelper.js:61:41)
at TelemetryGenerator.time (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/telemetryGenerators.js:54:18)
at Function.generate (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/telemetryHelper.js:61:26)
at EntryPointHandler.runFunctionWExtProps (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/common/entryPointHandler.js:26:75)
at context.subscriptions.push.vscode.commands.registerCommand (/home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13/src/extension/rn-extension.js:180:34)
at e._executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:697:706)
at e.$executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:698:212)
at e._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:658:87)
at e._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:657:779)
at e._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:656:851)
at e._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:656:620)
at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:655:544
at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:658:673
at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:96:599
at e.fire (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:97:917)
at u (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:159:721)
at Socket.<anonymous> (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:159:898)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at Socket.Readable.push (_stream_readable.js:136:10)
at Pipe.onread (net.js:560:20)
Hi @dominictwlee
Could you please open terminal in your VSCode and execute react-native -v and paste output here.
Thanks!
Sure, It's:
react-native-cli: 2.0.1
react-native: 0.56.0
Hi @dominictwlee what directory do you open? Is it root of react native project?
@ruslan-bikkinin Yep, root of react-native project created with react-native init.
react-native run-android works, but none of the commands in vscode are working.
@dominictwlee that's insteresting. Could you please try to run any extension command that leads to error and paste here Debug Console output?
@ruslan-bikkinin The only messages I get are from the Developer tools console and output as shown in my 1st post.
@dominictwlee I could reproduce your problem by installing react-native package (not react-native-cli!) globally and then by executing React Native > Run Packager command. In this case:
- Please, check that you have installed
react-native-clipackage globally, notreact-native. - If you are using nvm, please check that node versions that are available in VS Code and in system terminal are the same. Sometimes that could be a root of problems.
Please let us know if it helps you.
@ruslan-bikkinin
So node version has to match the one shown here?

Or do you mean node -v shows the same version in both system and vscode terminal? If so, yes they both show the same version which is 10.4.0 in my situation.
And yes, I'm using react-native-cli installed globally.
@dominictwlee could you please show screenshot of your project opened in VS Code after error being occured?

@ruslan-bikkinin
@dominictwlee What extensions, among React Native Tools, do you have installed?
@ruslan-bikkinin

@dominictwlee
Could you please check your settings(both user and workspace settings).
https://code.visualstudio.com/docs/getstarted/settings
Especially react-native-tools.projectRoot
@iTOYS react-native-tools.projectRoot is using the default "".
My other settings are:
{
"workbench.colorTheme": "Material Theme",
"files.autoSave": "off",
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.formatOnSave": true,
"window.zoomLevel": 0,
"emmet.syntaxProfiles": {
"javascript": "javascriptreact"
},
"files.associations": {
"*.js": "javascriptreact"
},
"workbench.iconTheme": "eq-material-theme-icons",
"materialTheme.fixIconsRunning": false,
"workbench.statusBar.visible": true,
"workbench.activityBar.visible": true,
"prettier.requireConfig": true,
"terminal.integrated.fontSize": 15,
"typescript.validate.enable": false,
"typescript.format.enable": false,
"javascript.validate.enable": false,
"emmet.triggerExpansionOnTab": true,
"flow.useNPMPackagedFlow": true
}
@dominictwlee what is the full path to package.json file? Seems to be that problem line is
https://github.com/Microsoft/vscode-react-native/blob/2c82a3f990836260c11640db528a30590867bb8a/src/common/reactNativeProjectHelper.ts#L25
and fs.existsSync method in your case unexpectedly returns false.
It is hard to say what's wrong in your particular case, so the only thing that I can suggest you is to try to debug extension itself on your side.
The instructions for that are the following:
- Run these commands in terminal:
git clone https://github.com/Microsoft/vscode-react-native.gitcd vscode-react-nativenpm i -g gulp && npm i - Open extension project in VS Code, then run
Quick Extension + Debuggerdebug configuration:
.
It should start new VS Code instance and debugger for the extension. You should see message like [/media/rbikkinin/work/projects/vscode-react-native]: Overwriting extension /home/rbikkinin/.vscode/extensions/vsmobile.vscode-react-native-0.6.13 with /media/rbikkinin/work/projects/vscode-react-native.. - Set breakpoint at
vscode-react-native/src/common/reactNativeProjectHelper.ts:25 - In just opened VS Code instance open you app directory and execute
Run Packagercommand. - Wait until breakpoint being hit and try to find out why your problem happens.
@ruslan-bikkinin Got this message when I completed tasks 1 and 2, any ideas why?

Should I go ahead and click debug anyway?
@dominictwlee Did you restart vscode after 1, 2 steps? Seems to be that it couldn't find quick-build task, that is defined in gulpfile.js. You can check whether it exists by clicking Tasks -> Run tasks... and wait a little bit for VSCode processing.
I'm getting this in the console output:
Gulp is not installed on your system. Run npm install -g gulp to install it.
The only thing I can think of is that vscode isn't detecting the folder where nvm saves it's global modules.
Any ideas?
@dominictwlee You can try to remove node_modules/.bin folder.
@ruslan-bikkinin Deleted node_modules/.bin file, and the same warning still popped up so I clicked Debug anyway.
2nd VScode popped up with message [/home/domtwlee/Projects/vscode-react-native]: Overwriting extension /home/domtwlee/.vscode/extensions/vsmobile.vscode-react-native-0.6.13 with /home/domtwlee/Projects/vscode-react-native..

Unverified breakpoints when attempting to set them on the 1st vscode window where debugger is running.
This shows up when I click on debugger restart.
Breakpoints can only be set on timers.js and net.js.