Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM task 'build' is passed a non-Buffer / String variable. #8864

Closed
TJKoury opened this issue May 17, 2020 · 6 comments · Fixed by #8897
Closed

NPM task 'build' is passed a non-Buffer / String variable. #8864

TJKoury opened this issue May 17, 2020 · 6 comments · Fixed by #8897

Comments

@TJKoury
Copy link
Contributor

TJKoury commented May 17, 2020

The method 'glslToJavaScript' is sometimes passed a Boolean.

Type conversions are not forced in Node 14.x and an exception is thrown. Recommend testing for Boolean and handling accordingly.

@OmarShehata
Copy link
Contributor

@TJKoury do you reproduce this just by running npm run build with Node 14.x ?

@TJKoury
Copy link
Contributor Author

TJKoury commented May 18, 2020

Tried it in Node 12.16.3, works (type coerced), behavior changed sometime between then and latest.

@LuminousPath
Copy link
Contributor

Can confirm this bug, running npm run build on v14.2.0 gives the error:

[14:42:18] TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type boolean (false)
    at Object.writeFileSync (fs.js:1380:5)
    at glslToJavaScript (D:\Projects\Cesium\cesium\gulpfile.cjs:1331:6)
    at D:\Projects\Cesium\cesium\gulpfile.cjs:186:3
    at build (D:\Projects\Cesium\cesium\node_modules\undertaker\lib\set-task.js:13:15)
    at bound (domain.js:429:14)
    at runBound (domain.js:442:12)
    at asyncRunner (D:\Projects\Cesium\cesium\node_modules\async-done\index.js:55:18)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

@LuminousPath
Copy link
Contributor

LuminousPath commented Jun 1, 2020

seems like the only thing requiring minify to be anything other than a boolean type is the fs.writeFileSync here

The majority of references require it to be a boolean, though.

it's a simple fix to change this to fs.writeFileSync(minifyStateFilePath, minify.toString());

@TJKoury
Copy link
Contributor Author

TJKoury commented Jun 1, 2020

I'd recommend changing it to just writing out a timestamp or something, though I guess that would be a bit redundant.

@mramato
Copy link
Contributor

mramato commented Jun 1, 2020

We're happy to look at a PR if someone wants to open one. It doesn't really matter that much what gets written out, as long as functionality remains unchanged and it fixes the Node 14 issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants