Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm publish fails with "error parsing json" #20787

Open
1 of 13 tasks
af-fess opened this issue May 28, 2018 · 10 comments
Open
1 of 13 tasks

npm publish fails with "error parsing json" #20787

af-fess opened this issue May 28, 2018 · 10 comments

Comments

@af-fess
Copy link

af-fess commented May 28, 2018

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • npm is producing incorrect or undesirable behavior.
  • Other (see below for feature requests):

What's going wrong?

I try to release react-native-appsflyer plugin

How can the CLI team reproduce the problem?

I ran $ npm publish -d

supporting information:

  • npm -v prints: 5.6.0

  • node -v prints: v7.2.1

  • npm config get registry prints: https://registry.npmjs.org/

  • Windows, OS X/macOS, or Linux?: MAC

  • Network issues:

    • Geographic location where npm was run:
    • I use a proxy to connect to the npm registry.
    • I use a proxy to connect to the web.
    • I use a proxy when downloading Git repos.
    • I access the npm registry via a VPN
    • [] I don't use a proxy, but have limited or unreliable internet access.
  • Container:

    • I develop using Vagrant on Windows.
    • I develop using Vagrant on OS X or Linux.
    • I develop / deploy using Docker.
    • I deploy to a PaaS (Triton, Heroku).

Logs:

$ npm publish -d
npm info it worked if it ends with ok
npm info using npm@5.6.0
npm info using node@v7.2.1
npm info lifecycle react-native-appsflyer@1.2.11~prepublish: react-native-appsflyer@1.2.11
npm info lifecycle react-native-appsflyer@1.2.11~prepare: react-native-appsflyer@1.2.11
npm info lifecycle react-native-appsflyer@1.2.11~prepublishOnly: react-native-appsflyer@1.2.11
npm info lifecycle react-native-appsflyer@1.2.11~prepack: react-native-appsflyer@1.2.11
npm info lifecycle react-native-appsflyer@1.2.11~postpack: react-native-appsflyer@1.2.11
npm info attempt registry request try #1 at 3:44:41 PM
npm http request PUT https://registry.npmjs.org/react-native-appsflyer
npm http 503 https://registry.npmjs.org/react-native-appsflyer
npm ERR! registry error parsing json
npm info retry will retry, error on last attempt: SyntaxError: Unexpected token N in JSON at position 0
npm info retry No frontdoor hosts available
npm info attempt registry request try #2 at 3:45:23 PM
npm http request PUT https://registry.npmjs.org/react-native-appsflyer
npm http 503 https://registry.npmjs.org/react-native-appsflyer
npm ERR! registry error parsing json
npm info retry will retry, error on last attempt: SyntaxError: Unexpected token N in JSON at position 0
npm info retry No frontdoor hosts available
npm info attempt registry request try #3 at 3:46:55 PM
npm http request PUT https://registry.npmjs.org/react-native-appsflyer
⸨░░░░░░░░░░░░░░░░░░⸩ ⠙ publish:react-native-appsflyer@1.2.11: http request PUT https://registry.npmjs.org/react-native-appsflyer
<--- Last few GCs --->

[28242:0x102801000]   186101 ms: Mark-sweep 1248.5 (1682.0) -> 1248.3 (1684.0) MB, 52.8 / 0.0 ms  allocation failure GC in old space requested
[28242:0x102801000]   186153 ms: Mark-sweep 1248.3 (1684.0) -> 1248.2 (1647.0) MB, 51.9 / 0.0 ms  last resort gc 
[28242:0x102801000]   186198 ms: Mark-sweep 1248.2 (1647.0) -> 1248.0 (1640.0) MB, 44.8 / 0.0 ms  last resort gc 


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x945a23c0d39 <JS Object>
    1: _writeGeneric [net.js:700] [pc=0x12474bba3842](this=0x2dd26edea899 <a TLSSocket with map 0x3a0901bd3ba9>,writev=0x945a23043b1 <true>,data=0x2dd26edf0949 <JS Array[2]>,encoding=0x945a2304471 <String[0]: >,cb=0x2d1a742f3a59 <JS Function WritableState.onwrite (SharedFunctionInfo 0x1a6155f97681)>)
    2: connect [net.js:673] [pc=0x12474bbe33d8](this=0x2dd26edea899 <a TLSSocket with map 0x3a09...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
 4: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
 5: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/usr/local/bin/node]
 6: v8::String::WriteUtf8(char*, int, int*, int) const [/usr/local/bin/node]
 7: node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*) [/usr/local/bin/node]
 8: node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 9: void node::StreamBase::JSMethod<node::TLSWrap, &(node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&))>(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
10: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
11: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
12: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
13: 0x12474ae063a7
Abort trap: 6

package size about 2 Mb

@darind
Copy link

darind commented May 28, 2018

We have encountered the exact same problem today with a 47MB package (This same package worked fine last week). Despite the error, the package uploads successfully and can be installed with npm i.

This error doesn't appear for smaller packages ~20MB.

@hulloitskai
Copy link

hulloitskai commented May 28, 2018

I'm getting the 'No frontdoor hosts available' when deprecating a package.

Update: This was fixed the following day (29-05-18)

@adrianth
Copy link

I'm having the same issue with a large package (100MB+) that I've been trying to publish it since two days ago. This is what I'm seeing in the console:

npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! publish Failed PUT 503
npm ERR! Unexpected token N in JSON at position 0
npm ERR! No frontdoor hosts available

Can someone from npm please comment on this issue?

@brianneisler
Copy link

I'm seeing the same issue when trying to add an owner to a package

npm owner add moltres-admin moltres

Logs

1 verbose cli   'add',
1 verbose cli   'moltres-admin',
1 verbose cli   'moltres' ]
2 info using npm@5.6.0
3 info using node@v8.11.1
4 verbose owner add moltres-admin to moltres
5 silly mapToRegistry name -/user/org.couchdb.user:moltres-admin
6 silly mapToRegistry using default registry
7 silly mapToRegistry registry https://registry.npmjs.org/
8 silly mapToRegistry data { type: 'directory',
8 silly mapToRegistry   registry: undefined,
8 silly mapToRegistry   where: '/Users/brianneisler/Sites/brianneisler/moltres',
8 silly mapToRegistry   raw: '-/user/org.couchdb.user:moltres-admin',
8 silly mapToRegistry   name: undefined,
8 silly mapToRegistry   escapedName: undefined,
8 silly mapToRegistry   scope: undefined,
8 silly mapToRegistry   rawSpec: '-/user/org.couchdb.user:moltres-admin',
8 silly mapToRegistry   saveSpec: 'file:-/user/org.couchdb.user:moltres-admin',
8 silly mapToRegistry   fetchSpec: '/Users/brianneisler/Sites/brianneisler/moltres/-/user/org.couchdb.user:moltres-admin',
8 silly mapToRegistry   gitRange: undefined,
8 silly mapToRegistry   gitCommittish: undefined,
8 silly mapToRegistry   hosted: undefined }
9 silly mapToRegistry uri https://registry.npmjs.org/-/user/org.couchdb.user:moltres-admin
10 verbose request uri https://registry.npmjs.org/-/user/org.couchdb.user:moltres-admin
11 verbose request new user, so can't send auth
12 info attempt registry request try #1 at 10:41:37
13 verbose request using bearer token for auth
14 verbose request id 406e6a935e5b0b5e
15 http request GET https://registry.npmjs.org/-/user/org.couchdb.user:moltres-admin
16 http 503 https://registry.npmjs.org/-/user/org.couchdb.user:moltres-admin
17 verbose bad json No frontdoor hosts available
18 error registry error parsing json
...snip

@m64253
Copy link

m64253 commented May 29, 2018

We are also seeing this on multiple packages

@jsteel jsteel mentioned this issue May 29, 2018
5 tasks
@RationalAnimal
Copy link

RationalAnimal commented May 30, 2018

I am also seeing this issue (for vui-ad-hoc-alexa-recognizer package). Was using node v6.x, switched to v10.x (latest) and still seeing this. Reports failure, but actually succeeds (tries the second time and reports that that version is already up and can't upload over it).

PS: same "Unexpected token N in JSON at position 0" as others are seeing.
PPS: my package isn't huge ~325K compressed, 3MB unpacked

@jsteel
Copy link

jsteel commented May 30, 2018

Works for me now after a fix was pushed for #20801 (comment)

@donnes
Copy link

donnes commented May 30, 2018

Same problem happening with npm deprecate:

$ npm deprecate @lighthouseit/ui@"<0.0.39" "important refactorings and improvement
s release from the v0.0.39"
npm ERR! registry error parsing json

@rwanauo
Copy link

rwanauo commented May 30, 2018

getting these sorts of errors on a build machine that has been working without issue for months
running. (this is in a hosted vsts build machine)

npm install
...
28646 info retry will retry, error on last attempt: SyntaxError: Unexpected token N in JSON at position 0
28646 info retry No frontdoor hosts available
28647 info attempt registry request try #3 at 1:55:36 PM
28648 http request GET http://registry.npmjs.org/@compone%2fdefine
28649 http 503 http://registry.npmjs.org/@compone%2fdefine
28650 verbose bad json No frontdoor hosts available
28651 error registry error parsing json

@jsteel
Copy link

jsteel commented May 30, 2018

I am getting errors just trying to install packages now. Same issue in CircleCI.

error An unexpected error occurred: "Received malformed response from registry for undefined. The registry may be down.".

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

No branches or pull requests

10 participants