Ionic-cli: ionic serve fails : with basic project installation : EPERM: operation not permitted

Created on 12 Apr 2016  路  11Comments  路  Source: ionic-team/ionic-cli

ionic serve fails.. Its just a basic ionic 2 angular 2 project installed with command "ionic start tab --v2 --ts "
it was working a little while ago.. i commit the basic working project and did the changes to page1.html. and it stopped working. It git the git checkout to discard the changes but it is still not working.

Here is the error in git bash :


$ ionic serve

Running 'serve:before' gulp task before serve
[13:07:31] Starting 'clean'...
[13:07:31] Finished 'clean' after 8.04 ms
[13:07:31] Starting 'watch'...
[13:07:31] Starting 'sass'...
[13:07:31] Starting 'html'...
[13:07:31] Starting 'fonts'...
[13:07:31] Starting 'scripts'...
[13:07:32] 'fonts' errored after 37 ms
[13:07:32] Error: EPERM: operation not permitted, mkdir 'C:\DEV\workspace\Github\travelMBTA\wwwbuild\fonts'
at Error (native)
[13:07:35] 'scripts' errored after 3.3 s
[13:07:35] Error: EPERM: operation not permitted, mkdir 'C:\DEV\workspace\Github\travelMBTA\wwwbuild\js'
at Error (native)
Live Reload failed to start, error: Error: EPERM: operation not permitted, lstat 'C:\DEV\workspace\Github\travelMBTA\wwwbuild'
Ionic serve failed - error: Error: EPERM: operation not permitted, lstat 'C:\DEV\workspace\Github\travelMBTA\wwwbuild'
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

ionic $ [13:07:35] 'sass' errored after 3.81 s
[13:07:35] Error: EPERM: operation not permitted, mkdir 'C:\DEV\workspace\Github\travelMBTA\wwwbuild\css'
at Error (native)
[13:07:35] 'html' errored after 3.8 s
[13:07:35] Error: EPERM: operation not permitted, mkdir 'C:\DEV\workspace\Github\travelMBTA\wwwbuild\pages\page1'
at Error (native)
7.7 MB bytes written (16.16 seconds)
Caught exception:
Error: EPERM: operation not permitted, mkdir 'C:\DEV\workspace\Github\travelMBTA\wwwbuild\js'
at Error (native)


i am working on windows 10
ionic version: 2.0.0-beta.24

Most helpful comment

The post suggest running this to increase the number of watches that are available.
run this command line from your terminal ass root and will be work fine
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

All 11 comments

Same error here :(

A similar problem was also reported in the forums.

Cordova CLI: 6.0.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS: Windows 8.1
Node Version: v5.11.0

npm version is 3.8.8
Caught exception:
 Error: watch C:\Users\Mark\My Documents\App Development\test2\app\pages\page3\p
age3.scss EPERM
    at exports._errnoException (util.js:893:11)
    at FSWatcher.start (fs.js:1313:19)
    at Object.fs.watch (fs.js:1341:11)
    at createFsWatchInstance (C:\Users\Mark\Documents\App Development\test2\node
_modules\chokidar\lib\nodefs-handler.js:37:15)
    at setFsWatchListener (C:\Users\Mark\Documents\App Development\test2\node_mo
dules\chokidar\lib\nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (C:\Users\Mark\Documents\App Dev
elopment\test2\node_modules\chokidar\lib\nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleFile (C:\Users\Mark\Documents\App Developm
ent\test2\node_modules\chokidar\lib\nodefs-handler.js:255:21)
    at FSWatcher.<anonymous> (C:\Users\Mark\Documents\App Development\test2\node
_modules\chokidar\lib\nodefs-handler.js:473:21)
    at FSReqWrap.oncomplete (fs.js:82:15)

I am the guy who had the similar problem as iignatov posted above.

The solution (if it's relevant to your situation)...

I assumed that since I am a single user with Admin rights to my computer that I would automatically be running the command prompts as Administrator. Turns out this is not the case.

By right-clicking on Windows Command Prompt (on Windows 8.1), selecting 'Run as Administrator', and navigating to my project folder and running ionic serve, I was able to run my ionic2 projects/starters flawlessly (i.e. without any errors whatsoever).

Still not sure at the time of writing how to ensure I'm running NodeJS Command Prompt (which I otherwise always use) as Administrator but at least I have a workaround to use the Windows Command Prompt in the interim.

I hope this helps.

Sorry you're having issues, and @Mobius77x glad you figured out a workaround.

This seems to be a common, as yet unsolved issue in certain Windows environments. Here are some resources that may help:
https://github.com/gulpjs/gulp/issues/660#issuecomment-68298496
https://github.com/gulpjs/gulp/issues/738
https://github.com/mwaylabs/generator-m-ionic/issues/223

Although this seems to be erroring even with using chokidar which it seemed gulp was claiming solved those issues.

I'm going to close this, as I'm not sure there's anything to be done on our end, but feel free to continue the discussion here, thanks.

So, for everyone getting EPERM errors on Windows the workaround is run the Node.js command prompt as Administrator or to configure it as follows:

  1. Locate the Node.js command prompt shortcut.
  2. Right-click it and select Properties.
  3. On the Shortcut tab click the button Advanced....
  4. Mark the Run as administrator checkbox.
  5. Click the OK button (twice) to apply the changes _(and Continue if there's a permission error/dialog)_.

The post suggest running this to increase the number of watches that are available.
run this command line from your terminal ass root and will be work fine
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

I need some help to fix this:

ionic serve

Running 'serve:before' gulp task before serve
[17:14:33] Starting 'clean'...
[17:14:33] Finished 'clean' after 52 ms
[17:14:33] Starting 'watch'...
[17:14:33] Starting 'sass'...
[17:14:33] Starting 'html'...
[17:14:33] Starting 'fonts'...
[17:14:33] Starting 'scripts'...
[17:14:33] 'html' errored after 94 ms
[17:14:33] Error: EPERM: operation not permitted, mkdir 'C:\dev\Aprendizado\ionic2\ionic2\ionic2app\www\build'
    at Error (native)
[17:14:40] 'fonts' errored after 6.49 s
[17:14:40] Error: EPERM: operation not permitted, mkdir 'C:\dev\Aprendizado\ionic2\ionic2\ionic2app\www\build\fonts'
    at Error (native)
Live Reload failed to start, error: Error: EPERM: operation not permitted, lstat 'C:\dev\Aprendizado\ionic2\ionic2\ionic2app\www\build'
Ionic serve failed - error: Error: EPERM: operation not permitted, lstat 'C:\dev\Aprendizado\ionic2\ionic2\ionic2app\www\build'
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

ionic $ [17:14:41] 'scripts' errored after 7.79 s
[17:14:41] Error: EPERM: operation not permitted, mkdir 'C:\dev\Aprendizado\ionic2\ionic2\ionic2app\www\build\js'
    at Error (native)
[17:14:41] 'sass' errored after 7.82 s
[17:14:41] Error: EPERM: operation not permitted, mkdir 'C:\dev\Aprendizado\ionic2\ionic2\ionic2app\www\build\css'
    at Error (native)
8.4 MB bytes written (13.63 seconds)
Caught exception:
 Error: EPERM: operation not permitted, mkdir 'C:\dev\Aprendizado\ionic2\ionic2\ionic2app\www\build\js'
    at Error (native)

Mind letting us know? https://github.com/driftyco/ionic-cli/issues

same error here on Linux system

+1

npm cache clean fixed it for me (thanks to https://github.com/npm/npm/issues/10826#issuecomment-165124144)

antivirus is likely causing the conflict...
Es probable que el antivirus est茅 causando el conflicto..

Was this page helpful?
0 / 5 - 0 ratings