Closed rask closed 2 years ago
actually, it is totally possible.
And when using recent versions of the driver, you indeed can omit NODE_PATH when node_modules
is a sibling of composer's vendor
folder (or of one of its ancestors), as we know have the JS script in the project instead of generating it in the temp folder.
Btw, this is exactly what we are doing on Travis.
We should probably update the doc as it is a simpler setup now (but the doc was written at a time where the JS script was still generated in a temp file, making the usage of NODE_PATH required)
@stof , are you sure, that we have removed temporary server generation code? I saw https://github.com/minkphp/MinkZombieDriver/blob/614cfc8793bd4661b816be0666db7a2a83636ea9/src/NodeJS/Server.php#L467 and it's still doing some str_replace of host port in temporary file.
@aik099 see https://github.com/minkphp/MinkZombieDriver/blob/614cfc8793bd4661b816be0666db7a2a83636ea9/src/NodeJS/Server/ZombieServer.php#L54 We still use the generation code when Mink is bundled in a phar (as node cannot access the source file in this case). And the str_replace call is deprecated. It is here for BC with people providing custom script file relying on it (see the deprecation warning).
Nice.
I see, will need to try it out. Thanks. :)
When I go to "/"
npm install --save-dev zombie@"^4.0"
(tried ^5.0 too)behat
Error:
Error: Cannot find module 'zombie/node_modules/tough-cookie'
How did you manage to get Zombie running as a local package as this is a reported issue with it? https://github.com/assaf/zombie/issues/955
@rask are you using npm 2 or npm 3 ? We might have an issue when using npm 3 which will flatten the node_modules.
Yes, npm3 and Yarn on some systems. It seems like a script to run npm install inside the zombie dir is needed or something to make this work.
No, we simply made a hacky code which relied on the way npm 2 was working (as npm 3 was not even starting to be developed at this time). We need to fix our code (the workaround in the meantime is to use npm 2)
We haven't really tried to use local zombie installation. @stof just said, that it might work theoretically.
According to https://github.com/assaf/zombie/issues/955 (link @rask mentioned above) the problem is with tough-cookie
package and in it's next release will be fixed.
No, we simply made a hacky code which relied on the way npm 2 was working (as npm 3 was not even starting to be developed at this time). We need to fix our code (the workaround in the meantime is to use npm 2)
Didn't knew that.
So the npm 3 uses different directory structure for dependencies compared to npm 2? I wonder how it will work if I have packages installed using npm 2 and then upgraded npm to 3?
If I remember correctly npm3 just flattens the node_modules directory (instead of nesting multiple node_modules dirs). It may break or not. But if code depends on the npm2 dir structure then the code will break.
@aik099 both structures are compatible with the node.js package resolution. Npm 3 changed the way it installed packages to dedupe as much as it can by default (npm 2 had a way to dedupe things too, with a dedicated command). If you upgrade to npm 3 and want to benefit from the deduped structure, the easiest way is to delete your node_modules folder and reinstall everything (and maybe npm3 is smart enough to upgrade the folder, but not sure).
@rask better fix: use the dev version of MinkZombieDriver, as we already fixed the issue (but not yet released)
If I'm not mistaken this is the fix: https://github.com/minkphp/MinkZombieDriver/commit/1153919e853cf5ebd828dae5d4d5b765a94820cd
@aik099 exactly
@stof using the dev stream worked! Any ideas when the change lands on a release version? :)
I will try to make a release this weekend, but I make no promise about it (I don't know how much time I can devote to Mink this weekend)
Great, no worries. :+1:
Any chance of a release with this fix in please?
@stof Still no release with this fix?
Anyone working on a legacy project will be interested in installing an older version of Zombie.js with:
npm install --save-dev npm-2
node_modules/.bin/npm-2 install --save-dev zombie@4
Closing this as 1.5.0 has been released in the meantime
All docs and tutorials tell to install Zombie as such:
and then setting
$NODE_PATH
to/usr/lib/node_modules
or similar.Would it be possible to use a local installation of Zombie without
$NODE_PATH
? E.g. parse the directory structure to find the nearestnode_modules
directory and fallback to$NODE_PATH
if not Zombie lib is found locally?I would like to use a local Zombie installation as we're trying to run Zombie+Behat tests in a shared CI environment that is a bit restricted.