m19c / gulp-run

Pipe to shell commands in gulp
ISC License
151 stars 25 forks source link

run().exec() cannot continue pipe #18

Closed JohanvdWest closed 9 years ago

JohanvdWest commented 10 years ago

Get a "Error: No path specified! Can not get relative."

Simple test task:

gulp.task('test', function () {
  return run("echo hello world", {cwd: './'}).exec()
    .pipe(rename("rest.txt"))
    .pipe(gulp.dest('./'));
});
JohanvdWest commented 10 years ago

This does not happen in vinyl 0.3.0, but it is an issue in 0.3.3.

ghost commented 10 years ago

Confirming and subscribing... forcing vinyl 0.3.0 fixes it.

jamesgecko commented 10 years ago

After forcing vinyl 0.3.0, I get the following error

module.js:340
    throw err;
          ^
Error: Cannot find module 'lodash.clonedeep'
  at Function.Module._resolveFilename (module.js:338:15)
  at Function.Module._load (module.js:280:25)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/Users/jdent/swamp-bunny/www/angular/node_modules/gulp-run/node_modules/vinyl/index.js:4:17)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/Users/jdent/swamp-bunny/www/angular/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/Users/jdent/swamp-bunny/www/angular/node_modules/gulp-run/lib/command.js:9:13)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/Users/jdent/swamp-bunny/www/angular/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/Users/jdent/swamp-bunny/www/angular/node_modules/gulp-run/gulp-run.js:9:15)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (/Users/jdent/swamp-bunny/www/angular/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/Users/jdent/swamp-bunny/www/angular/Gulpfile.coffee:12:7)
  at Object.<anonymous> (/Users/jdent/swamp-bunny/www/angular/Gulpfile.coffee:1:1)
  at Module._compile (module.js:456:26)
  at Object.loadFile (/Users/jdent/swamp-bunny/www/angular/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
  at Module.load (/Users/jdent/swamp-bunny/www/angular/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/Users/jdent/swamp-bunny/www/angular/gulpfile.js:2:1)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:108:3)
  at Liftoff.launch (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:143:6)
  at Object.<anonymous> (/usr/local/lib/node_modules/gulp/bin/gulp.js:59:5)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)
  at startup (node.js:119:16)
  at node.js:906:3
ghost commented 10 years ago

@jamesgecko how did you "force 0.3.0"? I had to have "vinyl": "0.3.0" in my package.json file, remove the node_modules directory and redo npm install.

jamesgecko commented 10 years ago

@seanpkps I used npm shrinkwrap, edited the vinyl dependency in the file generated by shrinkwrap to be 0.3.0, removed the node_modules directory and reinstalled everything. The npm installation output showed the correct version of vinyl was being used, and nothing else in my project depends on vinyl.

ghost commented 10 years ago

with the latest code I get this error:

Error: No path specified! Can not get relative.
    at File.Object.defineProperty.get (/Users/sean/Development/workspaces/tmpl-demo1/MyStore/setup/node_modules/gulp-run/node_modules/vinyl/index.js:123:27)
    at DestroyableTransform.saveFile [as _transform] (/Users/sean/Development/workspaces/tmpl-demo1/MyStore/setup/node_modules/gulp/node_modules/vinyl-fs/lib/dest/index.js:40:48)
    at DestroyableTransform.Transform._read (/Users/sean/Development/workspaces/tmpl-demo1/MyStore/setup/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (/Users/sean/Development/workspaces/tmpl-demo1/MyStore/setup/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/Users/sean/Development/workspaces/tmpl-demo1/MyStore/setup/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/Users/sean/Development/workspaces/tmpl-demo1/MyStore/setup/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (/Users/sean/Development/workspaces/tmpl-demo1/MyStore/setup/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
    at write (_stream_readable.js:601:24)
    at flow (_stream_readable.js:610:7)
    at _stream_readable.js:578:7

After removing my node_modules folder and running npm install --save vinyl@0.3.0 and then npm install, it works.

BUT If I remove my node_modules directory again, and do an npm install it fails!

really too bad this is broken

ghost commented 10 years ago

ah, of course I have to edit the package.json to make it exactly 0.3.0, not "^0.3.0"

cbarrick commented 9 years ago

This should be fixed in v1.6.5

The cause of the issue was how the vinyl file's path was being set. When a Vinyl file is created, it may not have a path. If it does not, gulp-run uses a default based on the name of the command. In Vinyl v0.3.0, an absent path meant file.path === null. In more recent versions, it means file.path === undefined. The check to see if the path is set has been updated from file.path === null to !file.path.

Merry Christmas