PavelVanecek / gulp-crx

Pack Chrome Extension in the pipeline.
31 stars 3 forks source link

ENOTDIR on a file. #7

Closed cbuteau closed 8 years ago

cbuteau commented 8 years ago

I just tried your package on windows and it fails with ENOTDIR on a file.

$ node ./node_modules/gulp/bin/gulp.js package
[15:24:52] Using gulpfile D:\chrome\listOfLists\gulpfile.js
[15:24:52] Starting 'package'...
[15:24:52] Finished 'package' after 43 ms
{ [Error: ENOTDIR: not a directory, scandir 'D:\chrome\listOfLists\dist\delete.png']
  errno: -4052,
  code: 'ENOTDIR',
  syscall: 'scandir',
  path: 'D:\\chrome\\listOfLists\\dist\\delete.png' }

This is the code. I found the easiest way was to create a staging area for the files I wanted. (dist)

  var manifest = require('./dist/manifest.json');
  var packageName = 'listOfLinks-' + manifest.version + '.zip';

  gulp.src('./dist/**').pipe(
    crx({
      privateKey: fs.readFileSync('./certs/listOfLists.pem'),
      filename: packageName
    }))
    .pipe(gulp.dest('package'));
cbuteau commented 8 years ago

I tried editing the code and dumping the stack and this was all I got.

    var onError = function(err) {
      console.error(err)
     // alteration.
     console.error(err.stack)
      done(new gutil.PluginError('gulp-crx', err))
    }
[15:39:42] Starting 'package'...
[15:39:42] Finished 'package' after 41 ms
{ [Error: ENOTDIR: not a directory, scandir 'D:\chrome\listOfLists\dist\delete.png']
  errno: -4052,
  code: 'ENOTDIR',
  syscall: 'scandir',
  path: 'D:\\chrome\\listOfLists\\dist\\delete.png' }
Error: ENOTDIR: not a directory, scandir 'D:\chrome\listOfLists\dist\delete.png'
    at Error (native)

I also tried upgrading to the lateset node because it seems to be a problem with fs. You use crx which uses wrench which uses fs.

$ node --version
v5.10.1

I am puzzled. I considered using crx directly but I saw what you were doing for favors and followed my code analysis to wrench and fs which seemed to be the real problem.

PavelVanecek commented 8 years ago

Sorry, I do not have any developer Windows machine to see if that's a platform or configuration issue. I would be glad if you try to debug what's going on. See the index.js file, there is not much this plugin is doing.

cbuteau commented 8 years ago

I debugged it pretty deep and it seemed to be some weirdness with fs itself. I used node-inspector and the base crx module uses promises so it was even more asynchronous.

I opened a bug on crx itself...but no one responded. https://github.com/oncletom/crx/issues/55

I am now investigating calling crx directly from the commandline. But that will prove more difficult to automate from gulp.

I'll close the bug since I don't think I can resolve it.