Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm publish error "toString()" failed

Tags:

npm

I am having trouble publishing my package with npm. here is a link to the project : https://github.com/alexbrillant/react-native-deck-swiper

I get the following error logs :

  0 info it worked if it ends with ok
  1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'publish' ]
  2 info using [email protected]
  3 info using [email protected]
  4 verbose npm-session 39bc34a765c36a83
  5 verbose publish [ '.' ]
  6 info lifecycle [email protected]~prepublish: [email protected]
  7 info lifecycle [email protected]~prepare: [email protected]
  8 info lifecycle [email protected]~prepublishOnly: [email protected]
  9 info lifecycle [email protected]~prepack: [email protected]
  10 info lifecycle [email protected]~postpack: [email protected]
  11 verbose getPublishConfig undefined
  12 silly mapToRegistry name react-native-deck-swiper
  13 silly mapToRegistry using default registry
  14 silly mapToRegistry registry https://registry.npmjs.org/
  15 silly mapToRegistry data { type: 'tag',
  15 silly mapToRegistry   registry: true,
  15 silly mapToRegistry   where: undefined,
  15 silly mapToRegistry   raw: 'react-native-deck-swiper',
  15 silly mapToRegistry   name: 'react-native-deck-swiper',
  15 silly mapToRegistry   escapedName: 'react-native-deck-swiper',
  15 silly mapToRegistry   scope: undefined,
  15 silly mapToRegistry   rawSpec: '',
  15 silly mapToRegistry   saveSpec: null,
  15 silly mapToRegistry   fetchSpec: 'latest',
  15 silly mapToRegistry   gitRange: undefined,
  15 silly mapToRegistry   gitCommittish: undefined,
  15 silly mapToRegistry   hosted: undefined }
  16 silly mapToRegistry uri https://registry.npmjs.org/react-native-deck-swiper
  17 verbose publish registryBase https://registry.npmjs.org/
  18 silly publish uploading /var/folders/db/546t9hvj7yj9fx1s_y5th8mm0000gn/T/npm-5094-27e90b4c/tmp/fromDir-6360d91d/package.tgz
  19 verbose stack Error: "toString()" failed
  19 verbose stack     at stringSlice (buffer.js:578:45)
  19 verbose stack     at Buffer.toString (buffer.js:633:10)
  19 verbose stack     at RegClient.putFirst (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/publish.js:103:23)
  19 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/publish.js:54:14
  19 verbose stack     at ConcatStream.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/concat-stream/index.js:36:43)
  19 verbose stack     at emitNone (events.js:111:20)
  19 verbose stack     at ConcatStream.emit (events.js:208:7)
  19 verbose stack     at finishMaybe (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:607:14)
  19 verbose stack     at endWritable (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:615:3)
  19 verbose stack     at ConcatStream.Writable.end (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:571:41)
  19 verbose stack     at ReadStream.onend (_stream_readable.js:595:10)
  19 verbose stack     at Object.onceWrapper (events.js:313:30)
  19 verbose stack     at emitNone (events.js:111:20)
  19 verbose stack     at ReadStream.emit (events.js:208:7)
  19 verbose stack     at endReadableNT (_stream_readable.js:1055:12)
  19 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
  20 verbose cwd /Users/alexandre/Documents/react-native/react-native-deck-swiper
  21 verbose Darwin 17.3.0
  22 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "publish"
  23 verbose node v8.9.4
  24 verbose npm  v5.6.0
  25 error "toString()" failed
  26 verbose exit [ 1, true ]
like image 941
AlexB Avatar asked Nov 27 '25 01:11

AlexB


1 Answers

As I see it, it's the same error reported here: https://github.com/npm/npm/issues/9552

Some searching indicates that "toString failed" is the error message that results when the string you're trying to serialize is too big for Node's Buffer code to serialize (i.e. it's over 256MiB).

If there is something huge inside your package try to add it to an .npmignore file and try to push again.

In your specific case I would first add the "exemple" folder into the .npmignore file and try to push again. I don't think this is needed by consumers of your package.

If anybody is looking for examples, you could guide them to github or your homepage.

like image 101
LukeFilewalker Avatar answered Nov 29 '25 23:11

LukeFilewalker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!