Volta: `gulp-cli` does not appear to work

Created on 29 Oct 2019  路  6Comments  路  Source: volta-cli/volta

When trying to run gulp from the command line, it crashes immediately

PS > volta install gulp-cli
success: installed [email protected] with executables: gulp

PS > gulp -v
internal/fs/utils.js:220
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir '\\?\C:\Users\dustin.masters\AppData\Local\Volta\tools\image\packages\gulp-cli\2.2.0/lib/versioned/'
    at Object.readdirSync (fs.js:870:3)
    at Object.<anonymous> (\\?\C:\Users\dustin.masters\AppData\Local\Volta\tools\image\packages\gulp-cli\2.2.0\index.js:31:17)
    at Module._compile (internal/modules/cjs/loader.js:971:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
    at Module.load (internal/modules/cjs/loader.js:822:32)
    at Function.Module._load (internal/modules/cjs/loader.js:730:14)
    at Module.require (internal/modules/cjs/loader.js:864:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (\\?\C:\Users\dustin.masters\AppData\Local\Volta\tools\image\packages\gulp-cli\2.2.0\bin\gulp.js:5:1)
    at Module._compile (internal/modules/cjs/loader.js:971:30) {
  errno: -4058,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '\\\\?\\C:\\Users\\dustin.masters\\AppData\\Local\\Volta\\tools\\image\\packages\\gulp-cli\\2.2.0/lib/versioned/'
}

Environment: Windows 10 1903 x64
Volta version: 0.6.4

bug

All 6 comments

I'm not familiar with the internals of volta yet, but with some poking I found:

  1. gulp-cli attempts readdirSync with a concatenated path (rather than, e.g., join())
    https://github.com/gulpjs/gulp-cli/blob/master/index.js#L30-L31
  2. when running via volta, the gulp-cli __dirname starts with \\?\C:\ per the error message in the description
  3. readdirSync ultimately throws the unexpected error:
    a. readdirSync supports \\?\C:\ (DOS?) paths
    b. readdirSync supports mismatched path separators
    c. apparently readdirSync does not support both a and b at the same time

image

I'm able to run gulp-cli successfully via volta if I make this change at https://github.com/gulpjs/gulp-cli/blob/master/index.js#L30-L31

//from
var ranges = fs.readdirSync(__dirname + '/lib/versioned/');
//to
var ranges = fs.readdirSync(path.join(__dirname, '/lib/versioned/'));

Hope that helps!

That _looks_ like there's an upstream issue, in that Gulp is misbehaving in its path handling, but this seems to be breaking in a way in Volta it's not with e.g. the base Node installer and/or nvm-windows?

Yes, that's correct. We were also curious whether volta did anything to patch __dirname and __filename.

The problem seems to be the specific combination of the way we canonicalize the path (using Rust's Path::canonicalize) when we invoke Gulp with Gulp's incorrect handling of the path itself. However, I think this is mostly an upstream in that we're actually doing the right thing and Gulp just needs the fix. Does that seem correct to you, @charlespierce?

@chriskrycho Yep, that sounds accurate. We're using a valid extended path (which means we handle the case when the path is longer than 260 characters), and Gulp is mishandling that case.

Created https://github.com/gulpjs/gulp-cli/pull/201 to resolve the upstream issue, but it doesn't look like that project has changed much recently. For usability, we should investigate whether it's possible to avoid using extended-length paths.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rwjblue picture rwjblue  路  3Comments

stefanpenner picture stefanpenner  路  6Comments

uasi picture uasi  路  3Comments

chriskrycho picture chriskrycho  路  4Comments

Stanzilla picture Stanzilla  路  3Comments