FormidableLabs / builder

An npm-based task runner
https://github.com/FormidableLabs/builder
MIT License
319 stars 26 forks source link

Nested builder command doesn't work in Windows. #165

Open trusktr opened 5 years ago

trusktr commented 5 years ago

I have a package.json script like builder run builder:foo where builder:foo is a builder command which runs other builder commands, but once it gets to the second level of nested builder calls (i.e. passed the first builder run builder:foo script, then I get an error like the following from PowerShell or CMD:

PS C:\Users\trusktr\src\trusktr+infamous> npm run dev

> infamous@21.0.6 dev C:\Users\trusktr\src\trusktr+infamous
> builder run build:dev

'builder' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! infamous@21.0.6 dev: `builder run build:dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the infamous@21.0.6 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\trusktr\AppData\Roaming\npm-cache\_logs\2019-02-18T22_03_18_249Z-debug.log

I'm on builder version 3.2.3. I generally don't like to update if things are working just fine, but I'm now trying to develop from Windows for the first time, and it's not working in PowerShell or CMD.

It works fine in WSL (Ubuntu, bash.exe).

Has this since been fixed in newer versions of builder? Is it time for an upgrade so I can get my Windows mojo on?

trusktr commented 5 years ago

Here's a reproduction (run it in PowerShell or CMD):

git clone git@github.com:trusktr/infamous.git
cd infamous
npm install
npm run dev

You can also run a builder script manually, and get the same error:

PS C:\Users\trusktr\src\trusktr+infamous> node .\node_modules\.bin\builder run build:dev
'builder' is not recognized as an internal or external command,
operable program or batch file.
[builder:builder-core:end:25508] Task: run build:dev, Error: Command failed: cmd /d /s /c builder run show:name && builder run build:dev:cjs

My build:dev script in my archetype is:

        "build:dev": "builder run show:name && builder run build:dev:cjs",
trusktr commented 5 years ago

Updated to 4.0.0, and everything still works great in Linux/macOS, and the output is much cleaner, nice! Same problem in Windows though.

ryan-roemer commented 5 years ago

I scanned the projects and the usage all looks correct.

I'm a bit overloaded right now, but will dig into your example repository (thanks for wrapping this up for me!) when I get a bit of time and a chance to spin up a Win VM!

trusktr commented 5 years ago

@ryan-roemer Thanks!

It's not a huge deal, as I can switch to a WSL Bash.exe terminal and it will work fine. I wanted to run it from Atom editor for convenience, and the terminal I was using inside Atom was a Windows-based one (CMD, PowerShell).