fusionjs / fusion-scaffolder

Migrated to https://github.com/fusionjs/fusionjs
MIT License
6 stars 10 forks source link

spawn yarn ENOENT error on Windows #46

Closed corydeppen closed 6 years ago

corydeppen commented 6 years ago

Type of issue

Bug

Description

I'm unable to create a new Fusion app on Windows. I've tried using Yarn and npm and neither will produce the app without the error mentioned below. I've seen several other similar issues across different repos mention using cross-spawn, so I'm hoping that might be a straightforward fix if this is confirmed to be an issue.

Current behavior

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: spawn yarn ENOENT
    at _errnoException (util.js:992:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Expected behavior

App is successfully created without an error.

Steps to reproduce

Yarn seems to have enough current issues running on Windows, so I'm using npm at the moment.

  1. npm i -g create-fusion-app
  2. create-fusion-app fusion-app-test
  3. Observe error mentioned above.

Your environment

jcuffe commented 6 years ago

The error is caused by this line of code: https://github.com/fusionjs/fusion-scaffolder/blob/master/index.js#L116

The problem is that windows considers yarn.cmd to be the correct name for yarn. The solution is found in this post on StackOverflow: https://stackoverflow.com/questions/37459717/error-spawn-enoent-on-windows

I'm brand new to npm module development, so it'll be a few days before I figure out how to make and test this fix myself, someone who is already familiar with the module can feel free to make the fix if they see this first ;)

corydeppen commented 6 years ago

I'm hopeful the fix is as simple as installing cross-spawn and changing the require statement to use cross-spawn.

KevinGrandon commented 6 years ago

Oops, I missed that comment and wasn't familiar with cross-spawn. Someone is free to open up a pull request though if they want to clean up the code a bit.

This was fixed by: https://github.com/fusionjs/fusion-scaffolder/pull/47#pullrequestreview-143419791

We're currently doing by-weekly releases, but I'll see if we can get a release out for this sooner rather than later.