axefrog / webpack-dnx-browsersync

A webpack plugin that runs the DNX web server in watch mode and integrates with browserSync, allowing webpack, dnx and browserSync to all work in harmony, reloading when any files change on the front or back end.
MIT License
1 stars 0 forks source link

Error: spawn dnx ENOENT #2

Open MarkPieszak opened 8 years ago

MarkPieszak commented 8 years ago

Looks like this line might be causing an error within your index.js:

    child = child_process.spawn("dnx", ['.', '--watch', self.options.dnx.command], {
        stdio: 'inherit'
    });

child_process.js is throwing Error: spawn dnx ENOENT

Found some information here, but not sure how to implement it. http://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js

Do you have a working example repo of all of this working together? Having one hell of a time getting browserSync to play with Kestrel & webpack!

axefrog commented 8 years ago

Hey, thanks for posting this issue. The two problems you'll be having are:

1) Kestrel doesn't work well with node.js just yet, which BrowserSync runs on. For local development, use WebListener, and change it to Kestrel when publishing. I believe the issue is fixed for rc2 though.

2) It can't find dnx because it needs ".cmd" at the end. The actual fix is to try to spawn dnx, and if ENOENT comes back, try again with "dnx.cmd". One of the two will work, as long as dnx exists in your PATH.

I don't have time to fix this right now but you're welcome to submit a pull request. Alternatively, clone the repo, make the fixes and then npm install directly from github i.e. npm install --save https://github.com/path-to/your-repo