How to fix the build error of "Error in plugin "webpack-stream" "?

I’d appreciate for your kindly support.
I tried to develop BJS environment locally on my MacBook Pro according to the post : Start Contributing to Babylon.js - Babylon.js Documentation

But I got the following error.

[21:14:59] Starting 'buildMin'...
ℹ 「atl」: Using typescript@3.3.3 from typescript
ℹ 「atl」: Using tsconfig.json from /Users/<folder>/Babylon/loaders/tsconfig.json
ℹ 「atl」: Checking started in a separate process...
✖ 「atl」: Checking finished with 2 errors
[21:15:05] 'buildMin' errored after 5.33 s
[21:15:05] Error in plugin "webpack-stream"
Message:
    [at-loader] ../../loaders/src/glTF/1.0/glTFLoader.ts:703:18 
    TS2352: Conversion of type 'Int32Array' to type 'Float32Array' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Types of property '[Symbol.toStringTag]' are incompatible.
    Type '"Int32Array"' is not comparable to type '"Float32Array"'.
[at-loader] ../../loaders/src/OBJ/objFileLoader.ts:1092:13 
    TS2322: Type 'FloatArray' is not assignable to type 'Nullable<IndicesArray>'.
  Type 'Float32Array' is not assignable to type 'Nullable<IndicesArray>'.
    Type 'Float32Array' is not assignable to type 'Uint16Array'.
      Types of property '[Symbol.toStringTag]' are incompatible.
        Type '"Float32Array"' is not assignable to type '"Uint16Array"'.
Details:
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false

[21:15:05] 'loaders' errored after 5.34 s
[21:15:05] 'typescript-libraries' errored after 1.77 min
[21:15:05] 'typescript-all' errored after 1.77 min
[21:15:05] 'default' errored after 2.2 min

What should I do for build?

My operation is the following:

$ cd <to Babylon/Tools/Gulp>
$ npm install -g npm@latest
$ npm install -g typescript
$ npm install -g gulp@4.0.0
$ npm install
$ npm run build

My environment

$ node -v
v11.1.0
$ npm -v
6.8.0
$ gulp -v
CLI version 2.0.1
Local version 4.0.0

Any help will be useful for me.

If you get the very latest version of master this problem should be gone:)

@Deltakosh Thanks for reply me!

I got the latest version from “GitHub - BabylonJS/Babylon.js: Babylon.js: a complete JavaScript framework for building 3D games with HTML 5 and WebGL” and tried the same commands.
But the same error remains.

I think it might not, but does it depend on Windows OS? Currently I use MacOSX.

I’ll try another my Windows PC.

Can you make sure that your local copy has this line correct:

@Deltakosh

Thanks! But the code in my local PC is the same as above. I didn’t modify anything after fork and clone.

Let me check this may be a new breaking change of TS (I’m using3.2.2)

Well even with 3.3.3 I have no issue
Would you mind forking again?

Thanks for your comment. I’d like to try 3.3.3, but where can I got the code?

I checked all tags but official latest tag seems to be 3.3.0.

3.3.3 was the Typescript version :slight_smile:
You can get Babylonjs v4.0 but just forking the latest version of master on our repo

Thanks for teaching me.
I checked the latest and 3.3.0 registered on tag. But the former has the same build error, the latter has the following error.

$ gulp
[23:21:28] Using gulpfile ~/Documents/BJS/BJS3.3.0/Babylon.js-3.3.0/Tools/Gulp/gulpfile.js
[23:21:28] Starting 'default'...
[23:21:28] Starting 'tsLint'...
[23:21:28] Starting 'typescript-tsLint'...
<dir>/BJS/BJS3.3.0/Babylon.js-3.3.0/src/Actions/babylon.actionManager.d.ts:29:21
ERROR: 29:21  no-trailing-whitespace  trailing whitespace
ERROR: 31:26  no-trailing-whitespace  trailing whitespace
ERROR: 33:26  no-trailing-whitespace  trailing whitespace
ERROR: 35:50  no-trailing-whitespace  trailing whitespace
ERROR: 37:27  no-trailing-whitespace  trailing whitespace

(several tens of ts file has the same error)

I tried the commands as the documentation said. I think environment of my PC is not enough to build BJS

I’m checking each library as gulp and npm settings and whether I should install libraries.

You can fix the linting errors by running ‘npm run build’

Oddly, there is no “build” definition in package.json of BJS3.3.0 tag.

{
    "name": "babylonjs",
    "version": "3.3.0",
    "description": "Babylon.js is a 3D engine based on webgl and javascript",
    "main": "",
    "repository": {
        "url": "https://github.com/BabylonJS/Babylon.js/"
    },
    "readme": "https://github.com/BabylonJS/Babylon.js/edit/master/readme.md",
    "license": "(Apache-2.0)",
    "devDependencies": {
        "@types/node": "^8.10.22",
        "chai": "^4.1.2",
        "color-support": "^1.1.3",
        "del": "3.0.0",
        "gulp": "^4.0.0",
        "gulp-clean-ts-extends": "~0.1.1",
        "gulp-concat": "~2.6.1",
        "gulp-content-to-variable": "^0.1.0",
        "gulp-debug": "^4.0.0",
        "gulp-expect-file": "^1.0.0",
        "gulp-optimize-js": "^1.1.0",
        "gulp-rename": "^1.4.0",
        "gulp-replace": "~1.0.0",
        "gulp-sourcemaps": "^2.6.5",
        "gulp-tslint": "^8.1.3",
        "gulp-typedoc": "^2.2.0",
        "gulp-typescript": "4.0.2",
        "gulp-uglify": "^3.0.1",
        "gulp-webserver": "^0.9.1",
        "karma": "^4.0.0",
        "karma-browserstack-launcher": "^1.3.0",
        "karma-chai": "^0.1.0",
        "karma-chrome-launcher": "^2.2.0",
        "karma-firefox-launcher": "^1.1.0",
        "karma-mocha": "^1.3.0",
        "karma-phantomjs-launcher": "^1.0.4",
        "karma-sinon": "^1.0.5",
        "merge2": "~1.2.2",
        "minimist": "^1.2.0",
        "mocha": "^5.2.0",
        "phantomjs-prebuilt": "^2.1.16",
        "sinon": "^6.1.4",
        "through2": "~2.0.3",
        "ts-loader": "^4.4.2",
        "tslint": "^5.11.0",
        "typedoc": "^0.12.0",
        "typescript": "~3.0.1",
        "webpack": "^4.16.3",
        "webpack-stream": "5.0.0"
    },
    "scripts": {
        "install": "cd ../../gui && npm install && cd ../Tools/Gulp/ &&  cd ../../inspector && npm install && cd ../Tools/Gulp/ && npm --prefix ../../Playground/ install ../../Playground/ && npm --prefix ../../tests/unit/ install ../../tests/unit/ && npm --prefix ../../Viewer/tests/ install ../../Viewer/tests/ && cd ../../Viewer && npm install && cd ../Tools/Gulp/ && gulp deployLocalDev"
    },
    "dependencies": {
        "acorn": "^6.1.0",
        "dts-bundle": "^0.7.3",
        "gulp-clean": "^0.4.0"
    }
}

oh but wait you are not on 4.0?
I thought you forked master?

Sorry for confusing.
I can not still build 4.0 with the same following error. So I tried to build 3.3.0 on tag. Both still fails.
That’s why I’m checking my environment.

[21:15:05] 'buildMin' errored after 5.33 s
[21:15:05] Error in plugin "webpack-stream"
Message:
    [at-loader] ../../loaders/src/glTF/1.0/glTFLoader.ts:703:18 
    TS2352: Conversion of type 'Int32Array' to type 'Float32Array' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Types of property '[Symbol.toStringTag]' are incompatible.
    Type '"Int32Array"' is not comparable to type '"Float32Array"'.
[at-loader] ../../loaders/src/OBJ/objFileLoader.ts:1092:13 

I fixed that issue on the master branch. I’ve jsut tested again :slight_smile:

I got the latest version and tried “npm run build” again.
There is no error at the “webpack-stream” and the build is proceeding.

It has been not finished yet, but it seems to works. I’ll comment the result again later :slight_smile:

1 Like

Wonderful!

“gulp run” is succeeded. I can access the following URL.

  1. Sandbox: http://localhost:1338/sandbox/index-local.html
  2. Playground: http://localhost:1338/Playground/index-local.html
  3. Materials Library: http://localhost:1338/materialsLibrary/index.html
  4. Post Process Library: http://localhost:1338/postProcessLibrary/index.html
  5. Procedural Textures Library: http://localhost:1338/proceduralTexturesLibrary/index.html
  6. Inspector: http://localhost:1338/inspector/index.html
  7. Local Dev: http://localhost:1338/localDev/index.html
  8. Build validation: http://localhost:1338/tests/validation/index.html

On the other hand, another errors are showed. It seems to be another issue. I’ll try to investigate and post as another issue if I can not resolve it.

Thanks a lot!

Firefox 63.0.0 (Mac OS X 10.14.0): Executed 97 of 98 (91 FAILED) (0 secs / 289 mFirefox 63.0.0 (Mac OS X 10.14.0): Executed 97 of 98 (91 FAILED) (295 mins 26.507 secs / 289 mins 41.042 secs)
TOTAL: 91 FAILED, 6 SUCCESS
[11:35:34] 'tests-validation-virtualscreen' errored after 4.87 h
[11:35:34] Error: 1
    at formatError (/user/.nodebrew/node/v11.1.0/lib/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/format-error.js:20:10)
    at Gulp.<anonymous> (/user/.nodebrew/node/v11.1.0/lib/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/log/events.js:31:15)
    at Gulp.emit (events.js:187:15)
    at Gulp.EventEmitter.emit (domain.js:441:20)
    at Object.error (/user/Documents/BJS/BJS_git_20190220/Babylon.js/node_modules/undertaker/lib/helpers/createExtensions.js:61:10)
    at handler (/user/Documents/BJS/BJS_git_20190220/Babylon.js/node_modules/now-and-later/lib/mapSeries.js:43:14)
    at f (/user/Documents/BJS/BJS_git_20190220/Babylon.js/node_modules/once/once.js:25:25)
    at f (/user/Documents/BJS/BJS_git_20190220/Babylon.js/node_modules/once/once.js:25:25)
    at tryCatch (/user/Documents/BJS/BJS_git_20190220/Babylon.js/node_modules/async-done/index.js:24:15)
    at done (/user/Documents/BJS/BJS_git_20190220/Babylon.js/node_modules/async-done/index.js:40:12)
    at removeAllListeners (/user/Documents/BJS/BJS_git_20190220/Babylon.js/node_modules/karma/lib/server.js:354:9)
    at webServer.close (/user/Documents/BJS/BJS_git_20190220/Babylon.js/node_modules/karma/lib/server.js:365:13)
    at Server.close (net.js:1573:9)
    at Object.onceWrapper (events.js:273:13)
    at Server.emit (events.js:187:15)
    at Server.EventEmitter.emit (domain.js:459:23)
    at emitCloseNT (net.js:1626:8)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)
[11:35:34] 'tests-all' errored after 4.92 h
[11:35:34] 'default' errored after 5.1 h
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! babylonjs@3.3.0 build: `gulp --max-old-space-size=8192 --tsLintFix`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the babylonjs@3.3.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1 Like