Closed electricmonk closed 8 years ago
I use the v1.0.1 too and i've the same issue. But i use only webdriverio in my project.
Thanks for the trick.
@electricmonk @FBerthelot does it work with v1.0.0
? On which platform are you running node?
Seems that /^win/.test(process.platform)
returns a wrong value / cc @mhoyer
@christian-bromann nope. I added opts.wdioBin
to the error message locally (might be a good idea to add it permanently) and it looked for the binary relative to gulp-webdriver
rather than relative to the project root. And it was not installed there, but rather in the project root.
edit: Regarding your previous comment, I'm running 0.12.7
on OS X 10.10.4. v1.0.0 also doesn't work.
@christian-bromann : For me it work with v1.0.0
I run my test on a kubuntu 14.04.
v1.0.1 works fine for me. (OS X 10.10.5)
I just ran into this as well. Specifying the path to wdioBin
as @electricmonk suggested got me past this error and onto the next one!
Ugh, I'm experiencing this issue as well now. Investigating…
Ok, got it. The issue isn't caused by a specific change in webdriverio, it's caused by npm v3 flattening the dependency tree. So the binary is now located at node_modules/.bin/wdio
, but gulp-webdriver is still searching at node_modules/gulp-webdriver/node_modules/.bin/wdio
.
Anybody knows a reliable way to get the path to the executable?
I had the same issue, using the following path didn't work either:
wdioBin: __dirname + '/node_modules/.bin/wdio'
because I was running my gulp tasks inside a child folder:
gulpfile.js
/gulp/tasks.js
This path worked for me, which is relative to the root directory:
wdioBin: './node_modules/.bin/wdio'
Hi,
Looks like this issue is back on windows.
When the dependency tree is flattened, there correctly is a wdio
file in node_modules/webdriverio/bin/
as well as in node_modules/.bin/
, however the wdio.cmd
can only be found in node_modules/.bin/
.
So I get this error:
Cannot find module 'webdriverio\bin\wdio.cmd' at Function.Module._resolveFilename (module.js:327:15) at Function.require.resolve (internal/module.js:17:19)
I don't know if it comes from the way webdriver.io is published in latest version or from changes in npm, however I know that the problem only occurred when I upgraded node and npm (worked like a charm with node 4/npm 2).
It can be fixed in my case by pasting manually a modified wdio.cmd
in webdriverio\bin
but it's not pretty ^^'
However, I'm not sure it's possible to make a fix taking into account all combinations of os/npm versions
edit: I thought I could supply a different path through opts but it's not even the case in 1.0.2: it's the require.resolve which throws, and as it's called in every cases before merging the opts there's nothing I can do. So at the moment I had to revert back to 1.0.1 and then use:
wdioOpts = {wdioBin: require('path').join('./node_modules', '.bin', isWin ? 'wdio.cmd' : 'wdio')};
in my gulpfile as gulp-webdriver options. (working because I forced npm3 as engine and put the .gulpfile at the project root)
The results are also different based on the version of webdriverio used. I'm using 2.4.5 to support webdrivercss:
npm uninstall webdriverio --save-dev
npm install webdriverio@2.4.5 --save-dev
When using this version, I had to change gulp-webdriver index.js line to:
wdioBin = require.resolve(path.join('.bin', isWin ? 'wdio.cmd' : 'wdio'));
I would suggest gulp-webdriver should check for the version of webdriverio and modify it's approach!
Using v1.0.1, when the top level project is dependent on both
gulp-webdriver
andwebdriverio
, the webdriverio module is installed in the top-levelnode_modules
dir. Running gulp with piping to gulp-webdriver, gulp fails with the aforementioned message.The problem is reproduced here: https://github.com/electricmonk/goos-nodejs/tree/e6c3a0453a211fb072f7777e04c7e9491e556ba5
The code that causes this failure is this (index.js):
which is caused by this line:
I managed to work around it by overriding the wdioBin option in my Gulpfile thus:
But I think that gulp-webdriver should be able to handle this case on its own.