node.js - 第一次使用 gulp 用户,无法构建骨架项目。我在网络上没有看到任何其他内容出现此错误

标签 node.js express gulp

嗨,这是我第一次使用 gulp,我正在尝试使用 typescript/gulp/express 来形成 RESTful Web 服务。

我为此找到了一个框架项目,但当我尝试构建它时出现错误。

这是该项目的链接: https://github.com/idanov/express-ts-rest

Kevins-Mac-Pro:express-ts-rest kevincmanning$ gulp buildAll
{ file: undefined,
  start: undefined,
  length: undefined,
  messageText: 'Failed to parse file \'src/tsconfig.json\': text.charCodeAt is not a function.',
  category: 1,
  code: 5014 }
{ file: undefined,
  start: undefined,
  length: undefined,
  messageText: 'Failed to parse file \'tests/tsconfig.json\': text.charCodeAt is not a function.',
  category: 1,
  code: 5014 }
[00:59:23] Using gulpfile ~/Projects/express-ts-rest/gulpfile.js
[00:59:23] Starting 'build'...
[00:59:23] 'build' errored after 10 ms
[00:59:23] TypeError: Cannot read property 'on' of null
    at DestroyableTransform.Readable.pipe (/Users/kevincmanning/Projects/express-ts-rest/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:516:7)
    at Gulp.<anonymous> (/Users/kevincmanning/Projects/express-ts-rest/gulpfile.js:35:10)
    at module.exports (/Users/kevincmanning/Projects/express-ts-rest/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/kevincmanning/Projects/express-ts-rest/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/kevincmanning/Projects/express-ts-rest/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Users/kevincmanning/Projects/express-ts-rest/node_modules/orchestrator/index.js:134:8)
    at /usr/local/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/index.js:46:20
    at nextTickCallbackWith0Args (node.js:415:9)
    at process._tickCallback (node.js:344:13)
    at Function.Module.runMain (module.js:443:11)

最佳答案

该项目在Ubuntu下运行良好。但是,OS X 的 gulp-tsb 包存在问题,导致您出现问题。您可以通过https://github.com/jrieken/gulp-tsb/issues/34跟进进度

同时,如果您想绕过它,只需在第 11 行编辑 node_modules/gulp-tsb/lib/index.js ,替换 fs_1.readFileSync(path, undefined);fs_1.readFileSync(path, 'utf-8');

关于node.js - 第一次使用 gulp 用户,无法构建骨架项目。我在网络上没有看到任何其他内容出现此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35884144/

相关文章:

javascript - 如何使用 webapp 生成器 gulp 构建非缩小的生产代码?

jquery - 在 Gulp 中 bundle jquery 和 Bootstrap

node.js - 让socket和http服务器监听同一个端口

javascript - 使用 Node.js(watson-developer-cloud 模块)发送 AlchemyData News 查询

javascript - Node 表示没有数据到达服务器

node.js - 使用 Okta OIDC 中间件时获取 "Error: state mismatch, could not find a state in the session"

node.js - 表不存在 Sequelize

node.js - npm开始报错

node.js - 在 REST API GET 请求中定义 MongoDB 集合

Gulp 在 gulp.watch 期间无法更新 css 文件