Gulp TypeError:Path必须是一个字符串。收到undefined

时间:2016-05-12 02:32:07

标签: gulp browserify babeljs babel

我想运行build命令,但收到错误消息:

TypeError:Path必须是字符串。收到undefined。

你们有什么想法吗?感谢。

gulp.task('build', function () {
    browserify("./src/components/source.js")
        .transform("babelify", {presets: ["es2015", "react"]})
        .bundle()
        .pipe(gulp.dest(path.resolve(__dirname, './src/app.js')));
});

以下是tracestack详细信息:

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:8:11)
    at Object.posix.resolve (path.js:426:5)
    at DestroyableTransform.saveFile [as _transform] (/Users/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/lib/dest/index.js:36:26)
    at DestroyableTransform.Transform._read (/Users/yzzhou/Documents/ReleasePlanner/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/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at doWrite (/Users/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
    at writeOrBuffer (/Users/yzzhou/Documents/ReleasePlanner/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/yzzhou/Documents/ReleasePlanner/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)

0 个答案:

没有答案