Skip to content

lerna bootstrap fails with "-4058" #226

Closed

Description

@Daniel15

I'm trying to build Jest, and Lerna is failing:

> @ postinstall C:\src\jest
> node ./scripts/postinstall.js && node ./scripts/build.js

Setting up Jest's development environment...
-> running: C:\src\jest\node_modules\.bin\lerna.cmd bootstrap cwd: C:\src\jest
Lerna v2.0.0-beta.20
Linking all dependencies
babel-plugin-jest-hoist
Errored while running BootstrapCommand.execute
-4058
-> failed running: C:\src\jest\node_modules\.bin\lerna.cmd bootstrap

Windows 10, node v4.4.3, npm v2.15.1, Lerna v2.0.0-beta.20

Activity

  1. hzoo commented on Jun 17, 2016

    @hzoo
    Contributor

    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

  2. gigabo commented on Jun 18, 2016

    @gigabo
    Contributor

    Doesn't look like sync-exec is 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 -4058 is ENOENT.

  3. Daniel15 commented on Jun 18, 2016

    @Daniel15
    ContributorAuthor

    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.

    Sent from my phone.

  4. Daniel15 commented on Jun 18, 2016

    @Daniel15
    ContributorAuthor

    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.

  5. hzoo commented on Jun 19, 2016

    @hzoo
    Contributor

    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

  6. gigabo commented on Jun 19, 2016

    @gigabo
    Contributor

    Yeah, seems like it must be something else. Here's the full change set for beta-20.

    The switch from exec to spawn in NpmUtilities.installInDir is another possibility.

    Could it be that npm is a .bat or .cmd file on windows?

    .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()).

  7. Daniel15 commented on Jun 19, 2016

    @Daniel15
    ContributorAuthor

    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.

  8. gigabo commented on Jun 19, 2016

    @gigabo
    Contributor

    image

    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?

  9. Daniel15 commented on Jun 19, 2016

    @Daniel15
    ContributorAuthor

    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. :(

  10. laurentdesmet commented on Jun 20, 2016

    @laurentdesmet
    Contributor

    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.

  11. cchamberlain commented on Jul 15, 2016

    @cchamberlain

    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?

    image

  12. hzoo commented on Jul 15, 2016

    @hzoo
    Contributor

    I think you would need to test on #236 since it's definetely not working right now

  13. hzoo commented on Aug 13, 2016

    @hzoo
    Contributor

    @Daniel15 @cchamberlain can everyone test on the latest version, beta 26?

  14. cchamberlain commented on Aug 15, 2016

    @cchamberlain

    Appears to be fixed for me, thanks!

  15. Daniel15 commented on Aug 19, 2016

    @Daniel15
    ContributorAuthor

    Working with Jest for me now, thanks!

  16. lock commented on Dec 28, 2018

    @lock

    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.

  17. locked as resolved and limited conversation to collaborators on Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions