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

TypeError: must start with number, buffer, array or string #8

Closed
gpbl opened this issue Oct 8, 2015 · 8 comments
Closed

TypeError: must start with number, buffer, array or string #8

gpbl opened this issue Oct 8, 2015 · 8 comments

Comments

@gpbl
Copy link

gpbl commented Oct 8, 2015

👋 I've upgraded to 0.1.1 and now I get the following error using this config. I'm on node 4.

$ webpack --stats --config ./webpack/prod.config.js

buffer.js:167
  throw new TypeError('must start with number, buffer, array or string');
  ^

Am I missing something?

@ryan-roemer
Copy link
Member

I've installed Node v4.1.2 and I'm trying different variations in https://github.com/FormidableLabs/webpack-stats-plugin/blob/master/demo/webpack.config.js#L16-L42 and I can't reproduce. Can you do a pull request / paste a code diff here with an update to https://github.com/FormidableLabs/webpack-stats-plugin/blob/master/demo/webpack.config.js#L16-L42 that errors with your error when running npm run build-demo?

Thanks!

@ryan-roemer
Copy link
Member

Finally reproduced it. The issue is that we no longer JSON.stringify the result of a transform to allow users to do atypical things like generate Markdown output, etc.

So the following:

      transform: function (data) {
        return JSON.stringify({
          main: data.assetsByChunkName.main[0],
          css: data.assetsByChunkName.main[1]
        }, null, 2);
      }

Should fix your issue. Can you confirm and close?

In parallel, I work on the documentation to enhance / correct it surrounding the issue.

@ryan-roemer
Copy link
Member

@gpbl -- Closing this as I think we've got your issue solved now. Feel free to re-open if that's not the case.

@gpbl
Copy link
Author

gpbl commented Nov 20, 2015

Thanks @ryan-roemer, it worked! Sorry for the late answer.

@aniket29081992
Copy link

how to get this fix?

@ryan-roemer
Copy link
Member

@aniket29081992 -- Please follow the example in my comment: #8 (comment)

If that doesn't work, please paste a GitHub link or a code snippet with context around your instantiation of new StatsWriterPlugin({ /*STUFF*/ })

@ganeshcoengg
Copy link

Unable to understand this error :

err TypeError: must start with number, buffer, array or string
at fromObject (buffer.js:244:9)
at Function.Buffer.from (buffer.js:118:10)
at new Buffer (buffer.js:97:17)
at decodeCredentials (C:\Working\develop\src\Netchex\node_modules\jspm-github\github.js:55:14)
at Object.GithubLocation (C:\Working\develop\src\Netchex\node_modules\jspm-

github\github.js:112:19)
at Object.exports.load (C:\Working\develop\src\Netchex\node_modules\jspm\lib\registry.js:73:56)
at new RegistryPath (C:\Working\develop\src\Netchex\node_modules\jspm\lib\config\loader.js:264:33)
at Config.read (C:\Working\develop\src\Netchex\node_modules\jspm\lib\config\loader.js:127:26)
at C:\Working\develop\src\Netchex\node_modules\jspm\lib\config.js:100:26
at process._tickCallback (internal/process/next_tick.js:103:7)
at Function.Module.runMain (module.js:449:11)
at startup (node.js:148:18)
at node.js:405:3

@ryan-roemer
Copy link
Member

@gvahinde - I don't see this loader in that stack trace and it looks like you're using jspm, not webpack?

If you are having an issue with this plugin, please open a new issue and include your full webpack configuration, the command you're running on the terminal and ideally full reproduction steps (if this is an open source project) so that we can better assist you.

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

4 participants