1
votes

First time posting a question on Stack Overflow even though I've visited onto stack overflow all the time. I'm trying out Windows 10 WSL (Windows Subsystem for Linux) feature after normally doing my development through an Ubuntu VM. Currently, I have a web project that is running node and MongoDB in WSL and I would like to have IntelliJ be my IDE on Windows.

I've been successful with running node and MongoDB through the WSL bash terminal. The only issue I'm facing is trying to configure IntelliJ to run node.js through WSL so I can debug code.

This is the current node.js configuration under Run/Debug Configuration:

Node interpreter: Ubuntu (Legacy) /usr/bin/node
Node parameters: --use_strict
Working directory: C:\Project\src\www\wizard
JavaScript File: server\start-server.js
Application parameters: 4242 4243 9000 127.0.0.1

This is the error that IntelliJ returns when I run this configuration:

"C:\Program Files\JetBrains\IntelliJ IDEA 182.4129.4\bin\runnerw.exe" C:\WINDOWS\System32\bash.exe -c "/usr/bin/node --use_strict /mnt/c/Project/src/www/wizard/server/start-server.js 4242 4243 9000 127.0.0.1"
runnerw.exe CreateProcess failed with error 2: The system cannot find the file specified.

Process finished with exit code 2

I've tried running this on IntelliJ 2018.2.1 and experimenting with IntelliJ 2018.2.2 EAP. But each version results in the same error.

For the sake of my curiosity, I ran the bash.exe command in a separate cmd prompt with the node arguments and it started the node server with no errors. I've also tried to run IntelliJ as administrator with the same results.

On a side note, I was able to set up and successfully run my backend mocha server unit test on IntelliJ using the Mocha Run/Build Configuration:

Node interpreter: Ubuntu (Legacy) /usr/bin/node
Working directory: C:\Project\src\www\wizard
Mocha package: C:\Project\src\www\wizard\node_modules\mocha
User interface: bdd
Extra Mocha options: --recursive
Test directory: C:\Project\src\www\wizard\server\test

This is the IntelliJ console outputs when I run the mocha build:

C:\WINDOWS\System32\bash.exe -c "/usr/bin/node /mnt/c/Project/src/www/wizard/node_modules/mocha/bin/_mocha --recursive --ui bdd --reporter /mnt/c/Users/Fanris/.IntelliJIdea2018.2/config/plugins/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js /mnt/c/Project/src/www/wizard/server/test"
...
Process finished with exit code 0

Has anyone else run into this error when trying to start the WSL node.js through IntelliJ? Is there any suggestion to fix or workaround on this? Hopefully, I provided enough information to help.

Seriously, thanks for any feedback...this has me scratching my head.

1

1 Answers

0
votes

known issue with runnerw.exe(JetBrains utility that runs external processes on Windows), caused by file system redirection and https://github.com/Microsoft/WSL/issues/223: no bash.exe installed in %windir%\Sysnative (which is a link to %windir%\SysWOW64 or %windir%\SysArm32). The problem is fixed in next major update (2018.3) - we have re-built runnerw.exe for 64-bit platform to address the issue.

For now I can only suggest using local Node.js interpreter instead of the legacy WSL