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

Doesn't work on Node 14 #594

Closed
boris-petrov opened this issue Apr 27, 2020 · 4 comments
Closed

Doesn't work on Node 14 #594

boris-petrov opened this issue Apr 27, 2020 · 4 comments

Comments

@boris-petrov
Copy link

boris-petrov commented Apr 27, 2020

I'm not exactly sure the problem is in this plugin, but I'm getting:

Build Error (PostcssCompiler)

The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of SourceMapGenerator

And the details in the log file:

  - broccoliBuilderErrorStack: TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of SourceMapGenerator
    at Object.writeFileSync (fs.js:1380:5)
    at /home/boris/project/node_modules/broccoli-postcss-single/index.js:82:12

  - code: [undefined]
  - codeFrame: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of SourceMapGenerator
  - errorMessage: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of SourceMapGenerator
        at PostcssCompiler
-~- created here: -~-
    at PostcssCompiler.Plugin (/home/boris/project/node_modules/broccoli-plugin/index.js:7:31)
    at PostcssCompiler.CachingWriter [as constructor] (/home/boris/project/node_modules/broccoli-caching-writer/index.js:18:10)
    at new PostcssCompiler (/home/boris/project/node_modules/broccoli-postcss-single/index.js:23:17)
    at /home/boris/project/node_modules/ember-cli-postcss/index.js:36:12
    at Array.map (<anonymous>:null:null)
    at PostcssPlugin.toTree (/home/boris/project/node_modules/ember-cli-postcss/index.js:33:36)
    at /home/boris/project/node_modules/ember-cli-preprocess-registry/preprocessors.js:188:26
    at Array.forEach (<anonymous>:null:null)
    at processPlugins (/home/boris/project/node_modules/ember-cli-preprocess-registry/preprocessors.js:186:11)
    at module.exports.preprocessCss (/home/boris/project/node_modules/ember-cli-preprocess-registry/preprocessors.js:156:10)
    at DefaultPackager.packageStyles (/home/boris/project/node_modules/ember-cli/lib/broccoli/default-packager.js:558:32)
    at EmberApp._legacyPackage (/home/boris/project/node_modules/ember-cli/lib/broccoli/ember-app.js:1618:44)
    at EmberApp.toTree (/home/boris/project/node_modules/ember-cli/lib/broccoli/ember-app.js:1663:27)
    at module.exports (/home/boris/project/ember-cli-build.js:299:14)
    at Builder.readBuildFile (/home/boris/project/node_modules/ember-cli/lib/models/builder.js:49:14)
    at Builder.setupBroccoliBuilder (/home/boris/project/node_modules/ember-cli/lib/models/builder.js:63:22)
    at new Builder (/home/boris/project/node_modules/ember-cli/lib/models/builder.js:29:10)
    at ServeTask.run (/home/boris/project/node_modules/ember-cli/lib/tasks/serve.js:49:7)
    at /home/boris/project/node_modules/ember-cli/lib/models/command.js:238:24
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Any ideas?

P.S. Everything is the latest possible version.

@jeffjewiss
Copy link
Owner

Thanks for reporting.

The line number referenced in the error is where sourcemaps are written to a file. I haven't looked into it yet, but it seems like something changed in Node 14 where the sourcemap information will need to be converted to a different type before written to a file.

If you're okay with temporarily disabling sourcemaps while I look into this you can do so by tweaking your options to have map: false in the compile step:

postcssOptions: {
  compile: {
    map: false,
    ...
  }
}

Please let me know if the above allows you to run the addon in Node 14. Thanks.

@boris-petrov
Copy link
Author

Thank you for the support!

You're right, disabling sourcemaps does fix the issue and ember serve starts fine now. So the issue is somewhere with them as you said.

@jeffjewiss
Copy link
Owner

You're welcome! Okay great, thanks for confirming that fixed the issue. I think I've found what's causing the problem, but I'll need to make the fix in one of the dependencies.

I'll close this issue once I've made a new patch release with the fix. Cheers.

@Pezmc
Copy link

Pezmc commented Nov 2, 2020

For anyone else landing here, while I can't find a specific PR that fixes this issue but I believe all the upgrades included as part of the 6.0.1 build fixed it and tests for Node 14 were also added in that release version: #597

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

No branches or pull requests

3 participants