cmelion / generator-ng2-webpack

An opinionated tool for scaffolding an app using angular2 and webpack
MIT License
109 stars 18 forks source link

npm 'open' not recognized when using npm start - under windows 10 #74

Closed aliabuthahir closed 8 years ago

aliabuthahir commented 8 years ago

npm 'open' not recognized when using npm start - under windows 10

cmelion commented 8 years ago

see https://github.com/pwnall/node-open/issues/55 I'll look into a cleaner way to open a browser window in a cross-platform way.

The quick fixes are: 1) edit the start task in package.json: "start": "concurrently \"npm run server\" \"npm run docker-client\"", *note: with this option you will then need to manually open http://localhost:2368 (assuming the default configuration) 2) edit the delayed open task in package.json: "delayed-open": "sleep 5 && start http://localhost:2368", 3) simply run npm run docker-client

If you would like to try Docker Beta for Windows (recommended) you can use the following approach:

Docker Quick Start

Steps:

notes:

aliabuthahir commented 8 years ago

yep!

manually we are able to open the app in web browser. may be we need a fix in the script for the generator, since it feels like a dependency failure.

aliabuthahir commented 8 years ago

Hi,

I've attached the npm debug log for your perusal. Also as we know it probably is not a npm issue.

npm-debug.zip

Regards, Ali

cmelion commented 8 years ago
23 error Failed at the app@0.0.0 delayed-open script 'sleep 5 && opn http://localhost:2368'.

That's strange, in the log, it's "opn" instead of "open"

aliabuthahir commented 8 years ago

yep!

modified the package.json to make use of 'opn' npm package instead of 'open' for the later was failing.

Regards, Ali

cmelion commented 8 years ago

Ahh, thanks. F.Y.I. I do accept Pull Requests.

cmelion commented 8 years ago

@aliabuthahir The delayed open is really just there to prevent the browser from displaying not-found messages. Sleep prevents that on Mac OSX, but does not work in Windows. Looking into alternatives.

cmelion commented 8 years ago

ok this works for me on Windows 10 and Mac OSX: npm install --save-dev system-sleep

use "opener" instead of open "delayed-open": "sleep 5 && opener http://localhost:2368",

I'll update and push out a new build.

cmelion commented 8 years ago

@allabuthahir Closing this issue. Feel free to re-open if you run into any problems.