You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
String concatenation should actually be fine, Windows handles both \ and /. There's probably some environmental assumptions made somewhere and
it's just coincidentally working on common Linux systems.
One of the main advantages of using JavaScript is that it's cross platform,
so it's silly for a Node library to only work on Linux (unless there's some
native component of course).
"-4058" and "ENOENT" are both terrible error messages. It's unfortunate but
Node.js is pretty well known for having unintelligible error messages.
Just confirmed that Lerna v2.0.0-beta.19 works as expected.
I'm not sure it's directly related to sync-exec though. I just tested with a standalone project and it works fine:
var syncExec = require('sync-exec');
var result = syncExec('dir');
console.log('RESULT: ', result.stdout);
C:\src\testappwithjest ([email protected])
λ node test.js
RESULT: Volume in drive C is Windows
Volume Serial Number is C6A7-A39E
Directory of C:\src\testappwithjest
.....
Additionally, I'm on Node v4 so Lerna shouldn't even be using the sync-exec module. I wonder if it's some other change that was included in beta 20.
Right I kept thinking that was the only change but I see some other stuff like I added the add-module-exports plugin and also changed the main key in package.json
.bat and .cmd files are not executable on their own without a terminal and therefore cannot be launched using child_process.execFile() (or even child_process.spawn()).
Could it be that npm is a .bat or .cmd file on windows?
Yes, that's correct. npm is a .cmd file that calls node passing the right parameters. All Node.js scripts in the node_modules/.bin directory are also .cmd files on Windows.
So... that change was made to fix #213. Lerna was slurping up all output from npm and failing if it exceeded maxBuffer. Don't want to regress there.
@Daniel15 - Is there a common pattern for working around this limitation of spawn on windows? Is win-spawn, or something like it, going to be the answer here?
Looks like win-spawn is deprecated and cross-spawn and cross-spawn-async are the replacements. I imagine that'd work though, they even use npm in the example. 👍
It really sucks that a core Node.js function isn't cross-platform. That's the entire point of a core library - to not have to worry about things like this. :(
I tried out beta.24 on Windows to see if anything changed and I do not even receive an error anymore, it just stops. Any roadmap or PR / testing needed?
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Activity
hzoo commentedon Jun 17, 2016
I'm trying to figure out the issue - might just need to republish or it's
sync-exec- #221 but beta.19 should work.might need to test master/beta.20 locally on windows to know
gigabo commentedon Jun 18, 2016
Doesn't look like
sync-execis made to work on windows.Building paths with string concatenation all over.
But that should only be an issue on node
0.10, right?Looks like
-4058isENOENT.Daniel15 commentedon Jun 18, 2016
String concatenation should actually be fine, Windows handles both
\and/. There's probably some environmental assumptions made somewhere andit's just coincidentally working on common Linux systems.
One of the main advantages of using JavaScript is that it's cross platform,
so it's silly for a Node library to only work on Linux (unless there's some
native component of course).
"-4058" and "ENOENT" are both terrible error messages. It's unfortunate but
Node.js is pretty well known for having unintelligible error messages.
Sent from my phone.
Daniel15 commentedon Jun 18, 2016
Just confirmed that Lerna v2.0.0-beta.19 works as expected.
I'm not sure it's directly related to
sync-execthough. I just tested with a standalone project and it works fine:Additionally, I'm on Node v4 so Lerna shouldn't even be using the sync-exec module. I wonder if it's some other change that was included in beta 20.
hzoo commentedon Jun 19, 2016
Right I kept thinking that was the only change but I see some other stuff like I added the add-module-exports plugin and also changed the main key in package.json
gigabo commentedon Jun 19, 2016
Yeah, seems like it must be something else. Here's the full change set for beta-20.
The switch from
exectospawninNpmUtilities.installInDiris another possibility.Could it be that
npmis a.bator.cmdfile on windows?Daniel15 commentedon Jun 19, 2016
Yes, that's correct.
npmis a.cmdfile that callsnodepassing the right parameters. All Node.js scripts in thenode_modules/.bindirectory are also.cmdfiles on Windows.gigabo commentedon Jun 19, 2016
So... that change was made to fix #213. Lerna was slurping up all output from
npmand failing if it exceededmaxBuffer. Don't want to regress there.@Daniel15 - Is there a common pattern for working around this limitation of
spawnon windows? Iswin-spawn, or something like it, going to be the answer here?Daniel15 commentedon Jun 19, 2016
Looks like win-spawn is deprecated and cross-spawn and cross-spawn-async are the replacements. I imagine that'd work though, they even use
npmin the example. 👍It really sucks that a core Node.js function isn't cross-platform. That's the entire point of a core library - to not have to worry about things like this. :(
laurentdesmet commentedon Jun 20, 2016
I made a pull request that replaces
child_process.spawn. Fixing PR #230 would also be a next step in having more robust Windows support.cchamberlain commentedon Jul 15, 2016
I tried out
beta.24on Windows to see if anything changed and I do not even receive an error anymore, it just stops. Any roadmap or PR / testing needed?hzoo commentedon Jul 15, 2016
I think you would need to test on #236 since it's definetely not working right now
hzoo commentedon Aug 13, 2016
@Daniel15 @cchamberlain can everyone test on the latest version, beta 26?
cchamberlain commentedon Aug 15, 2016
Appears to be fixed for me, thanks!
Daniel15 commentedon Aug 19, 2016
Working with Jest for me now, thanks!
lock commentedon Dec 28, 2018
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.