Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into wslpath error #106

Open
brianqvpham opened this issue Sep 18, 2019 · 16 comments
Open

Running into wslpath error #106

brianqvpham opened this issue Sep 18, 2019 · 16 comments

Comments

@brianqvpham
Copy link

I am running into the following wslpath error in the getAllPrefixesWsl function here when using the module. It looks like wslpath is operating in a manner different to what the code expects. I'm using version 1.2.0.

image

@birtles
Copy link
Collaborator

birtles commented Sep 18, 2019

Hmm, that's curious. I wonder if there is something about the path that needs to be escaped in that case.

@birtles
Copy link
Collaborator

birtles commented Sep 18, 2019

Oh, never mind, I think you are hitting the issue fixed in #105. I was waiting for a few more bug fixes before doing a new release but maybe we should just release it.

Can you try updating to the trunk version and seeing if the error is fixed?

@brianqvpham
Copy link
Author

Updated to the trunk version, and still running into the same error. Not sure if this will be more helpful but here is the full stack dump

wslpath: /tmp/yarn--1568903824882-0.8540578043502847: Invalid argument
child_process.js:650
    throw err;
    ^

Error: Command failed: wslpath -w "/tmp/yarn--1568903824882-0.8540578043502847"
wslpath: /tmp/yarn--1568903824882-0.8540578043502847: Invalid argument

    at checkExecSyncError (child_process.js:607:13)
    at execSync (child_process.js:647:13)
    at getAllPrefixesWsl (/mnt/c/Users/brian/Documents/frontend/node_modules/karma-firefox-launcher/index.js:83:25)
    at getFirefoxExeWsl (/mnt/c/Users/brian/Documents/frontend/node_modules/karma-firefox-launcher/index.js:115:22)
    at Object.<anonymous> (/mnt/c/Users/brian/Documents/frontend/node_modules/karma-firefox-launcher/index.js:256:20)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
error Command failed with exit code 1.

@birtles
Copy link
Collaborator

birtles commented Sep 19, 2019

That's odd. If I run wslpath -w "/tmp/yarn--1568903824882-0.8540578043502847" in an Ubuntu terminal, I get \\wsl$\Ubuntu-18.04\tmp\yarn--1568903824882-0.8540578043502847.

Can you try just running that command by itself to see what you get? And might I ask what kind of WSL distro you are using?

@brianqvpham
Copy link
Author

I'm running Ubunutu 18.04.1 LTS. When I run wslpath -w "/tmp/yarn--1568903824882-0.8540578043502847" I get wslpath: /tmp/yarn--1568903824882-0.8540578043502847: Invalid argument.

Strangely enough, when I try wslpath -w "/mnt/c/tmp/yarn--1568903824882-0.8540578043502847" I get C:\tmp\yarn--1568903824882-0.8540578043502847 instead of an error message.

@birtles
Copy link
Collaborator

birtles commented Sep 24, 2019

Oh, interesting. I suppose there is some setting somewhere that affects this. I don't suppose you recall tweaking anything to that effect?

@brianqvpham
Copy link
Author

Nope I don't believe I've modified any setting related to this. I suspect that this may be just isolated to my environment as you were unable to recreate the same behavior. I'll try to reinstall my WSL distro when I get a chance to see if that fixes anything.

@birtles
Copy link
Collaborator

birtles commented Sep 29, 2019

Thanks! Please let me know if you have any luck or not after re-installing.

@jdraymon
Copy link

jdraymon commented Oct 17, 2019

I have a similar issue:

#16 3.976 /bin/sh: 1: wslpath: not found
#16 4.082 17 10 2019 22:14:54.956:ERROR [config]: Error in config file!
#16 4.082  { Error: Command failed: wslpath -w "/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin"
#16 4.082 /bin/sh: 1: wslpath: not found

I'm using WSL2 + the official Ubuntu 18.04 image & the docker WSL2 preview, and FWIW I'm trying to run firefox installed in a docker container, not call out to the system firefox

I can create a separate issue if you don't think it's relevant here.

@birtles
Copy link
Collaborator

birtles commented Oct 17, 2019

Oh, interesting. Does WSL2 not ship with wslpath perhaps? Can you check if wslpath works when you execute it directly?

@jdraymon
Copy link

jdraymon commented Oct 25, 2019

@birtles yes it does - the karma runner just seems to somehow detect as being in WSL when it's really running in docker on top of a linux kernel. is-wsl looks at /proc/version for 'microsoft', and inside of docker, finds it. But inside of docker, the microsoft utilities (like wslpath) don't exist.

Would it be worth adding an additional configuration option here? I kind of understand the original use-case behind WSL detection but in this case I'd like to override it, as I'm installing firefox into the container.

@birtles
Copy link
Collaborator

birtles commented Oct 26, 2019

So, is that to say you're running the Linux version of Firefox? If so, it sounds like issue #107.

@andb0t
Copy link

andb0t commented Apr 12, 2020

There's a temporary hack by manually altering the code in node_modules\karma-firefox-launcher\index.js to call execSync('wslpath -w /mnt/c/' + ...) instead of execSync('wslpath -w ' + ...) in two appearances. With this and FirefoxHeadless I got it running.

andb0t added a commit to andb0t/test_angular that referenced this issue Apr 12, 2020
In addition, as mentioned in
karma-runner/karma-firefox-launcher#106 on WSL
there's a hack in the karma firefox launcher index.js file necessary to
accomodate a wslpath error.
@c0gnize
Copy link

c0gnize commented Aug 7, 2020

Even I don't use Firefox as browser: karma start --single-run --browsers ChromeHeadless0
have similar error:

07 08 2020 17:29:53.027:ERROR [plugin]: Error during loading "/mnt/d/pa/webui/node_modules/karma-firefox-launcher" plugin:
  Command failed: wslpath -w "/home/cognize/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin"
wslpath: /home/cognize/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin: No such file or directory

07 08 2020 17:29:53.460:INFO [karma-server]: Karma v5.1.1 server started at http://localhost:9876/
07 08 2020 17:29:53.460:INFO [launcher]: Launching browsers ChromeHeadless0 with concurrency 1
07 08 2020 17:29:53.461:ERROR [karma-server]: Error: Found 1 load error
    at Server.<anonymous> (/mnt/d/pa/webui/node_modules/karma/lib/server.js:189:27)
    at Object.onceWrapper (events.js:417:28)
    at Server.emit (events.js:323:22)
    at emitListeningNT (net.js:1343:10)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)```

@TheSasch
Copy link

TheSasch commented Oct 12, 2020

@birtles yes it does - the karma runner just seems to somehow detect as being in WSL when it's really running in docker on top of a linux kernel. is-wsl looks at /proc/version for 'microsoft', and inside of docker, finds it. But inside of docker, the microsoft utilities (like wslpath) don't exist.

Would it be worth adding an additional configuration option here? I kind of understand the original use-case behind WSL detection but in this case I'd like to override it, as I'm installing firefox into the container.

It is still a problem. Tryed to build an application which uses karma with trion/ng-cli-karma as build container where headless firefox is installed, but it still tries to access the wsl option.

@birtles
Copy link
Collaborator

birtles commented Oct 12, 2020

It is still a problem. Tryed to build an application which uses karma with trion/ng-cli-karma as build container where headless firefox is installed, but it still tries to access the wsl option.

That might be fixed by #116 (or #114?). In any case, we should release a new version with those fixes so I filed #121 for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants