ef4 / ember-browserify

ember-cli addon for easily loading CommonJS packages from npm via browserify.
MIT License
172 stars 28 forks source link

Fails with permission / unable to find directory errors on windows #17

Closed djmitchella closed 9 years ago

djmitchella commented 9 years ago

Repro steps, starting from scratch (windows 7, both running command window as an administrator and running it as a normal user; it's fine on OSX, though)

  1. make new folder, cd into it
  2. ember init (which is 0.1.9 in a clean new project as I write this, but the same thing happens in our real app which is on 0.1.7)
  3. ember serve -- everything is fine, so now kill the 'ember serve' process.
  4. npm install --save-dev ember-browserify
  5. ember serve

    The errors below then show up, and the build fails.

version: 0.1.9 Livereload server on port 35729 Serving on http://0.0.0.0:4200/ file added tmp\tree_merger-tmp_dest_dir-qOP4od3z.tmp file added tmp\tree_merger-tmp_dest_dir-5y54JYP9.tmp file added tmp\tree_merger-tmp_dest_dir-VeagFb1A.tmp file added tmp\tree_merger-tmp_dest_dir-DC27vcNR.tmp file added tmp\tree_merger-tmp_dest_dir-SpOnyBgV.tmp file added tmp\tree_merger-tmp_dest_dir-6gOp0QPL.tmp file added tmp\tree_merger-tmp_dest_dir-pd3f2Bs6.tmp\application.hbs file added tmp\custom_static_compiler-tmp_dest_dir-0xrSnujl.tmp\et1 file added tmp\tree_merger-tmp_dest_dir-wgUnulH7.tmp\et1 file added tmp\template_compiler-tmp_dest_dir-Ri7J3AXX.tmp\et1 file changed tmp\tree_merger-tmp_dest_dir-pd3f2Bs6.tmp\application.hbs file added tmp\tree_merger-tmp_dest_dir-pd3f2Bs6.tmp\components file added tmp\funnel-dest_mrlUOx.tmp file added tmp\template_compiler-tmp_cache_dir-J6fV2RXP.tmp file added tmp\tree_merger-tmp_dest_dir-yvfxTSAd.tmp EPERM, operation not permitted 'G:\Source\dan2\et1\tmp\core_object-input_staging-ZHlKXn8z.tmp' Error: EPERM, operation not permitted 'G:\Source\dan2\et1\tmp\core_object-input_staging-ZHlKXn8z.tmp' at Object.fs.mkdirSync (fs.js:642:18) at Function.sync (G:\Source\dan2\et1\node_modules\ember-browserify\node_modules\mkdirp\index.js:70:13) at CoreObject.module.exports.CoreObject.extend.rebuild (G:\Source\dan2\et1\node_modules\ember-browserify\lib\caching-browserify.js:66:12) at G:\Source\dan2\et1\node_modules\ember-browserify\lib\caching-browserify.js:48:23 at $$$internal$$tryCatch (G:\Source\dan2\et1\node_modules\ember-browserify\node_modules\rsvp\dist\rsvp.js:490:16) at $$$internal$$invokeCallback (G:\Source\dan2\et1\node_modules\ember-browserify\node_modules\rsvp\dist\rsvp.js:502:17) at G:\Source\dan2\et1\node_modules\ember-browserify\node_modules\rsvp\dist\rsvp.js:1096:13 at Object.$$rsvp$asap$$flush as _onImmediate at processImmediate as _immediateCallback ENOTEMPTY, directory not empty 'G:\Source\dan2\et1\tmp\funnel-dest_9EqpWH.tmp\templates' Error: ENOTEMPTY, directory not empty 'G:\Source\dan2\et1\tmp\funnel-dest_9EqpWH.tmp\templates' at Object.fs.rmdirSync (fs.js:612:18) at rmkidsSync (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\rimraf\rimraf.js:247:11) at rmdirSync (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\rimraf\rimraf.js:237:7) at fixWinEPERMSync (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\rimraf\rimraf.js:150:5) at rimrafSync (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\rimraf\rimraf.js:216:26) at G:\Source\dan2\et1\node_modules\ember-cli\node_modules\rimraf\rimraf.js:245:5 at Array.forEach (native) at rmkidsSync (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\rimraf\rimraf.js:244:26) at rmdirSync (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\rimraf\rimraf.js:237:7) at fixWinEPERMSync (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\rimraf\rimraf.js:150:5) file added tmp\six_to_five-tmp_dest_dir-lDs7wNAs.tmp file added tmp\custom_static_compiler-tmp_dest_dir-581BRTnR.tmp file added tmp\tree_merger-tmp_dest_dir-d6XbACAW.tmp file added tmp\tree_merger-tmp_dest_dir-weCuShOm.tmp file added tmp\tree_merger-tmp_dest_dir-6Y6nZsLs.tmp file added tmp\tree_merger-tmp_dest_dir-OInPPiTK.tmp file added tmp\tree_merger-tmp_dest_dir-696eNf7S.tmp file added tmp\tree_merger-tmp_dest_dir-CBArhVJr.tmp

G:\Source\dan2\et1\node_modules\ember-cli\node_modules\broccoli-sane-watcher\node_modules\sane\src\node_watcher.js:206 throw new Error('Unable to find directory in registery: ' + dir); ^ Error: Unable to find directory in registery: g:\Source\dan2\et1\tmp\funnel-dest_9EqpWH.tmp\components at NodeWatcher.detectChangedFile (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\broccoli-sane-watcher\node_modules\sane\src\node_watcher.js:206:11)

at NodeWatcher.normalizeChange (G:\Source\dan2\et1\node_modules\ember-cli\node_modules\broccoli-sane-watcher\node_modules\sane\src\node_watcher.js:250:10)
at FSWatcher.EventEmitter.emit (events.js:98:17)
at FSEvent.FSWatcher._handle.onchange (fs.js:1039:12)
  1. npm uninstall --save-dev ember-browserify
  2. ember serve -- now it's back working again.

    Some other things I noticed which may or may not help narrow this down:

    1. I get the same errors if I remove tmp/ and dist/ before re-running 'ember build', or if I npm install ember-browserify before the first attempt to build.
    2. The 'file added tmp\tree_merger...' messages don't show up until I've added ember-browserify
    3. If I remove the ember-browserify line from package.json, but leave the ember-browserify folder under node_modules, the ember serve process starts working again. (I'm not exactly sure what this tells us, but I thought I'd mention it)
johnnyshields commented 9 years ago

:+1: +1 same issue on Windows, issue is caused by adding this lib as described above.

bjornstar commented 9 years ago

I just replicated this on a windows machine, the problem is here - https://github.com/ef4/ember-browserify/blob/master/lib/caching-browserify.js#L148

Capitalization of the drive letter is mismatched and causes ember to watch the project directory (a bad thing).

dir:  c:\Users\Bjorn\test_project
self.root: C:\Users\Bjorn\test_project

Investigating possible solutions.

johnnyshields commented 9 years ago

wouldn't a case insensitive comparison work?

ef4 commented 9 years ago

Probably, but I wonder where else in ember-cli this is biting people.