ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Adding gulpStartupTasks to ionic.project causes ionic serve to error on 1.2.5

Open boardman opened this issue 12 years ago • 13 comments

Adding gulpStartupTasks parameter in ionic.project causes ionic serve to fail with the following error.

Rogers-MacBook-Pro:tester roger$ ionic serve
Gulp startup tasks: [ 'sass', 'watch' ]
Running dev server: http://172.17.10.222:8100
Running live reload server: http://172.17.10.222:35729
Watching : [ 'www/**/*', '!www/lib/**/*' ]
Ionic server commands, enter:
  restart or r to restart the client app from the root
  goto or g and a url to have the app navigate to the given url
  consolelogs or c to enable/disable console log output
  serverlogs or s to enable/disable server log output
  quit or q to shutdown the server and exit

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

My ionic.project file is as follows

{
  "name": "Tester",
  "app_id": "com.bxthree.tester",
  "gulpStartupTasks": ["sass", "watch"]
}

This doesn't seem to be related to the tasks specified within gulpStartupTasks. All tasks specified within this parameter can be run directly via Gulp without issue. Specifying an empty array for gulpStartupTasks also causes the error.

{
  "name": "Tester",
  "app_id": "com.bxthree.tester",
  "gulpStartupTasks": []
}

Removing gulpStartupTasks from ionic.project allows ionic serve to one again function normally.

Thanks

boardman avatar Sep 16 '14 12:09 boardman

Would you be able to run npm install first and then see if you still get the error? Thanks

adamdbradley avatar Sep 16 '14 14:09 adamdbradley

No problem, the issue still persists after running npm install however. I've also upgraded to latest version of node just in case but no difference.

Rogers-MacBook-Pro-:tester roger$ node -v
v0.10.31

boardman avatar Sep 17 '14 08:09 boardman

What OS and version are you on?

adamdbradley avatar Sep 18 '14 03:09 adamdbradley

OS X 10.9.4

boardman avatar Sep 18 '14 07:09 boardman

@boardman, 172. IPs can be a bit buggy, especially on older routers. Would you be able to try this on a 10. or 192.168. network?

perrygovier avatar Sep 18 '14 13:09 perrygovier

To reset your default IP selection you'll need to run ionic address

adamdbradley avatar Sep 18 '14 13:09 adamdbradley

Thanks for the continued suggestions. I've tried it on a 192.168. network but there is no change.

I see the problem even in the simplest scenario, creating a blank project with ionic start test, then editing ionic.project to include gulpStartupTasks with an empty list will throw the error.

{
    "name": "test",
    "app_id": "",
    "gulpStartupTasks": []
}

I'm getting the impression that this must be down to my local configuration given no one else is seeing the issue.

boardman avatar Sep 19 '14 09:09 boardman

Not sure if this was solved yet or not, however I ran into the same problem recently and the fix was to ensure gulp was installed globally npm install gulp -g so that the spawn method actually had something to spawn.

pmichelotti avatar Oct 28 '14 16:10 pmichelotti

I was also having the same issue and "npm install gulp -g" solved it. ionic serve apparently prefers to have it locally as it says: "Local gulp not found. Try running: npm install gulp"

bpevangelista avatar Nov 06 '14 05:11 bpevangelista

I fixed this by installing Imagemagick and gulp.

TheArchitect78 avatar Nov 17 '14 19:11 TheArchitect78

The following finally fixed this for me also

npm install -g imagemagick

boardman avatar Nov 20 '14 10:11 boardman

This is still a problem. Would be nice for this to work out of the box, or at least for the documentation to mention the workaround.

Cross referencing with the forum: http://forum.ionicframework.com/t/ionic-serve-spawn-enoent/9079/10

depsypher avatar Dec 20 '14 17:12 depsypher

@depsypher - I've updated the CLI to run a few checks:

If the user has gulpStartupTasks specified, but does not have gulp installed globally, they shall be shown a message to do so.

I hope this resolves the issue you have had. This should ship in 1.3.1.

jbavari avatar Jan 21 '15 23:01 jbavari