You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gulp-nodemon implements synchronously running tasks on restart by launching gulp using spawnSync:
function run(tasks) {
if (typeof tasks === 'string') tasks = [tasks]
if (tasks.length === 0) return
if (!(tasks instanceof Array)) throw new Error('Expected task name or array but found: ' + tasks)
cp.spawnSync(process.platform === 'win32' ? 'gulp.cmd' : 'gulp', tasks, { stdio: [0, 1, 2] }) // <==!
}
When gulp is installed globally spawnSync finds gulp in the PATH and runs it but when gulp is locally installed in "node_modules/.bin/" spawnSync fails with ENOENT because it can't find gulp.
To me it seems like you want to always use the locally installed gulp, the same version you're using when you require('gulp'). To achieve this we can do something like:
function run(tasks) {
if (typeof tasks === 'string') tasks = [tasks]
if (tasks.length === 0) return
if (!(tasks instanceof Array)) throw new Error('Expected task name or array but found: ' + tasks)
var gulpPath = path.join(process.cwd(), 'node_modules/.bin/')
var gulpCmd = path.join(gulpPath, process.platform === 'win32' ? 'gulp.cmd' : 'gulp')
cp.spawnSync(gulpCmd, tasks, { stdio: [0, 1, 2] }) // <==!
}
What do you think of this? It's a pretty small change but I can make a pull request if you'd like.
The text was updated successfully, but these errors were encountered:
@dmm until #135 lands, the good news is that if you run gulp via yarn run or npm run, the local node_modules/.bin is placed at the beginning of $PATH, and the local gulp should be used anyway 😊
gulp-nodemon implements synchronously running tasks on restart by launching gulp using spawnSync:
When gulp is installed globally spawnSync finds gulp in the PATH and runs it but when gulp is locally installed in "node_modules/.bin/" spawnSync fails with ENOENT because it can't find gulp.
To me it seems like you want to always use the locally installed gulp, the same version you're using when you require('gulp'). To achieve this we can do something like:
What do you think of this? It's a pretty small change but I can make a pull request if you'd like.
The text was updated successfully, but these errors were encountered: