npm ERR! error parsing json


(Évelyne Lachance) #1

I’m attempting to publish a package that has been fine for dozens of versions, but all of a sudden I’m getting npm ERR! error parsing json . This is not MY json, it’s coming from the npm registry. I’m not the only one that is having this issue.

From google searches, I’ve attempted a few things, including deleting .npmrc and running npm adduser and npm login. The full log is: https://text.evie.codes/sagipuyosa.sql

Others around me are also having this issue.


(Lee Henson) #2

Same here. Can’t publish a private package because:

info attempt registry request try #1 at 15:27:58
34 verbose request using bearer token for auth
35 verbose request id b01090d50e985571
36 http request PUT https://registry.npmjs.org/<package name>
37 http 500 https://registry.npmjs.org/@<package name>
38 verbose bad json An error occurred
39 error registry error parsing json
40 verbose headers { date: 'Mon, 30 Jul 2018 14:28:00 GMT',
40 verbose headers   'content-type': 'text/plain;charset=UTF-8',
40 verbose headers   'content-length': '17',
40 verbose headers   connection: 'keep-alive',
40 verbose headers   'set-cookie':
40 verbose headers    [ '__cfduid=<removed>; expires=Tue, 30-Jul-19 14:27:58 GMT; path=/; domain=.registry.npmjs.org; HttpOnly' ],
40 verbose headers   'expect-ct':
40 verbose headers    'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
40 verbose headers   server: 'cloudflare',
40 verbose headers   'cf-ray': '<removed>' }
41 info retry will retry, error on last attempt: SyntaxError: Unexpected token A in JSON at position 0

(Mohamed Mahrous) #3

We also have the same error and we were wondering why, the JSON is fine
my npm ver5.6.0


(Alexanderknapstein) #4

Same here. We are not able to publish a private package!


(Alexanderknapstein) #5

Hey guys,

we found out, that our package.json was not valid. After fixing that, we could publish again.
see here: http://package-json-validator.com/

Cheers, Alex


(Kat Marchán) #6

This is a duplicate of npm ERR! registry error parsing json


(Kat Marchán) #7