npm发布错误" toString()"失败

时间:2018-01-25 18:35:44

标签: npm

我无法使用npm发布我的软件包。 这是项目的链接:https://github.com/alexbrillant/react-native-deck-swiper

我收到以下错误日志:

  0 info it worked if it ends with ok
  1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'publish' ]
  2 info using npm@5.6.0
  3 info using node@v8.9.4
  4 verbose npm-session 39bc34a765c36a83
  5 verbose publish [ '.' ]
  6 info lifecycle react-native-deck-swiper@1.4.7~prepublish: react-native-deck-swiper@1.4.7
  7 info lifecycle react-native-deck-swiper@1.4.7~prepare: react-native-deck-swiper@1.4.7
  8 info lifecycle react-native-deck-swiper@1.4.7~prepublishOnly: react-native-deck-swiper@1.4.7
  9 info lifecycle react-native-deck-swiper@1.4.7~prepack: react-native-deck-swiper@1.4.7
  10 info lifecycle react-native-deck-swiper@1.4.7~postpack: react-native-deck-swiper@1.4.7
  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 ]

1 个答案:

答案 0 :(得分:4)

我认为,此处报告的错误相同:https://github.com/npm/npm/issues/9552

  

有些搜索表明&#34; toString失败&#34;是错误消息   当您尝试序列化的字符串太大时,会产生这种情况   Node的序列化缓冲区代码(即它超过256MiB)。

如果您的软件包中有大量内容,请尝试将其添加到.npmignore文件中并尝试再次推送。

在你的具体情况下,我会首先添加&#34;例如&#34;将文件夹放入.npmignore文件并尝试再次推送。我不认为你的包裹的消费者需要这个。

如果有人在寻找示例,您可以引导他们访问github或您的主页。