运行基础构建失败并显示错误:TypeError:stream.on不是函数

时间:2018-04-11 00:34:06

标签: gulp zurb-foundation zurb-foundation-6 npm-request

与新客户合作,他们的前端人员发送他们的工具链设置。他们使用macosx(Linux),它适用于他们。在Windows 10专业版中,它无法正常运行构建例程。我已经尝试了几天,看看在最终构建步骤中使它工作所需的内容。

C:\ Users \ xxxxx \ source \ repos \ xxxx-kentico-website \ CMS \ PatternLibrary> npm run build

> foundation-zurb-template@1.0.0 build C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary
> gulp build --production

[19:22:05] Failed to load external module @babel/register
[19:22:05] Requiring external module babel-register
[19:22:09] Using gulpfile ~\source\repos\xxxx-kentico-website\CMS\PatternLibrary\gulpfile.babel.js
[19:22:09] Starting 'build'...
[19:22:09] Starting 'clean'...
[19:22:09] Finished 'clean' after 66 ms
[19:22:09] Starting 'pages'...
[19:22:09] Starting 'sass'...
[19:22:09] Starting 'javascript'...
[19:22:09] Starting 'images'...
[19:22:09] Starting 'copy'...
[19:22:10] 'images' errored after 1.34 s
[19:22:10] **TypeError: stream.on is not a function**
    at Readable.wrap (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\readable-stream\lib\_stream_readable.js:817:10)
at wrap (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\stream-combiner2\index.js:67:29)
at combine (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\stream-combiner2\index.js:29:18)
at Function.module.exports.obj (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\stream-combiner2\index.js:22:10)
at Imagemin.createStream (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\imagemin\index.js:103:24)
at Imagemin.run (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\imagemin\index.js:77:20)
at DestroyableTransform.through.obj.percent (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\gulp-imagemin\index.js:56:12)
at DestroyableTransform._transform (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\through2-concurrent\through2-concurrent.js:30:15)
at DestroyableTransform.Transform._read (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\readable-stream\lib\_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\readable-stream\lib\_stream_transform.js:170:83)
at doWrite (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\readable-stream\lib\_stream_writable.js:406:64)
at writeOrBuffer (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\readable-stream\lib\_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\readable-stream\lib\_stream_writable.js:322:11)
at DestroyableTransform.ondata (C:\Users\xxxxx\source\repos\xxxx-kentico-website\CMS\PatternLibrary\node_modules\readable-stream\lib\_stream_readable.js:612:20)
at DestroyableTransform.emit (events.js:180:13)
at DestroyableTransform.emit (domain.js:439:23)
[19:22:10] 'build' errored after 1.42 s
[19:22:10] The following tasks did not complete: pages, sass, javascript, copy
[19:22:10] Did you forget to signal async completion?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! foundation-zurb-template@1.0.0 build: `gulp build --production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the foundation-zurb-template@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxxxx\AppData\Roaming\npm-cache\_logs\2018-04-10T23_22_10_624Z-debug.log

使用的版本:

Foundation CLI version 2.2.5
Node v9.10.1
Gulp CLI version 3.9.1
Gulp Local version 4.0.0-alpha.3
Ruby Sass 3.5.6
Windows 10 Pro Version 10.0.16299.309
Python 2.7.9 (client requirement)
NPM 5.6.0
GIT version 2.16.2.windows.1
客户端包json:
{
  "name": "foundation-zurb-template",
  "version": "1.0.0",
  "description": "Official ZURB Template for Foundation for Sites.",
  "main": "gulpfile.babel.js",
  "scripts": {
    "start": "gulp",
    "build": "gulp build --production"
  },
  "author": "ZURB <foundation@zurb.com>",
  "license": "MIT",
  "dependencies": {
    "access-sniff": "^3.1.0",
    "foundation-sites": "~6.4.1",
    "imagemin-jpegtran": "^5.0.2",
    "jquery": ">=3.0.0",
    "motion-ui": "~1.2.2",
    "node-sass": "^4.8.3",
    "what-input": "^4.1.3"
  },
  "devDependencies": {
    "babel-core": "^6.24.1",
    "babel-loader": "^6.4.1",
    "babel-preset-es2015": "^6.24.1",
    "babel-register": "^6.26.0",
    "browser-sync": "^2.10.0",
    "colors": "^1.1.2",
    "gulp": "github:gulpjs/gulp#4.0",
    "gulp-accessibility": "^3.0.1",
    "gulp-autoprefixer": "^3.1.0",
    "gulp-babel": "^6.1.2",
    "gulp-clean-css": "^3.3.1",
    "gulp-cli": "^1.2.1",
    "gulp-color": "0.0.1",
    "gulp-concat": "^2.5.2",
    "gulp-extname": "^0.2.0",
    "gulp-htmlhint": "^2.0.0",
    "gulp-if": "^2.0.0",
    "gulp-imagemin": "^2.4.0",
    "gulp-load-plugins": "^1.1.0",
    "gulp-sass": "^2.1.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-uglify": "^1.2.0",
    "gulp-uncss": "^1.0.1",
    "gulp-util": "^3.0.8",
    "gulp-wcag-accessibility": "0.0.1",
    "imagemin-pngquant": "^4.2.2",
    "js-yaml": "^3.4.6",
    "panini": "^1.3.0",
    "rimraf": "^2.4.3",
    "style-sherpa": "^1.0.0",
    "vinyl-named": "^1.1.0",
    "webpack": "^2.6.1",
    "webpack-stream": "^3.2.0",
    "yargs": "^3.8.0"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/zurb/foundation-zurb-template.git"
  },
  "bugs": {
    "url": "https://github.com/zurb/foundation-sites/issues",
    "email": "foundation@zurb.com"
  },
  "babel": {
    "presets": [
      "es2015"
    ]
  },
  "private": true
}

2 个答案:

答案 0 :(得分:0)

请尝试使用nvm切换到Node.js 8。问题出在可读流,而不是基础网站。

请使用zurb-foundation代码而不是foundation代码,然后使用zime。

尝试链接到您在GitHub上发布的问题。没有链接的交叉通常不是最好的解决方案。

答案 1 :(得分:0)

也许您不再需要帮助,但无论如何。

几天前我遇到了同样的问题,并进行了更改:

"gulp": "github:gulpjs/gulp#4.0", for "gulp": "^4.0.0",(请确保在此之后运行npm install)

并切换到Node v 7.10.1(如Daniel所说,使用nvm)