执行 Typescript 转译时出现以下错误:
TypeError: file.isSymbolic is not a function
at DestroyableTransform.normalize [as _transform] (D:\project\node_modules\vinyl-fs\lib\dest\prepare.js:31:15)
at DestroyableTransform.Transform._read (D:\project\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (D:\project\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_transform.js:170:83)
at doWrite (D:\project\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:406:64)
at writeOrBuffer (D:\project\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (D:\project\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_writable.js:322:11)
at Pumpify.Duplexify._write (D:\project\node_modules\pumpify\node_modules\duplexify\index.js:201:22)
at doWrite (D:\project\node_modules\pumpify\node_modules\readable-stream\lib\_stream_writable.js:406:64)
at writeOrBuffer (D:\project\node_modules\pumpify\node_modules\readable-stream\lib\_stream_writable.js:395:5)
at Pumpify.Writable.write (D:\project\node_modules\pumpify\node_modules\readable-stream\lib\_stream_writable.js:322:11)
我的 gulp 任务如下所示:
gulp.task('tsc', function () {
let tsResult = gulp.src(srcPaths.tsFiles)
.pipe(tsProject()); // tsProject created previously
return tsResult.js
.pipe(gulp.dest(buildPath)); // -> the gulp.dest(..) command causes the error
});
package.json devDependencies(仅 gulp 和 ts 相关依赖项)如下所示:
{
"devDependencies": {
"gulp": "github:gulpjs/gulp#4.0",
"gulp-sourcemaps": "^2.6.1",
"gulp-tslint": "^8.1.2",
"gulp-typescript": "^3.2.3",
"tslint": "^5.8.0",
"typescript": "^2.5.0",
}
}
Node 版本:8.9.3 & npm 版本:5.6.0
有人知道该怎么做吗?
最佳答案
来自 gulp 存储库(issue):
phated commented 5 hours ago
Your plugins need to be updated to use a newer vinyl. The one they are using to create file objects is really old.
同一问题的另一种解决方案(对我有用):
dozer75 commented 4 hours ago • edited
... You can reference the previous commit id instead of the branch name after the #. The last one is 6d71a65
关于javascript - gulp typescript 时出现 TypeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47941277/