Package not accessible from npm
Hello,
I am not able to install dependencies of my project anymore. Error npm log:
4922 silly fetchPackageMetaData error for is-string@^1.0.4 404 Not Found: is-string@^1.0.4
When doing npm view is-string, I get the following output:
npm ERR! registry error parsing json npm ERR! Unexpected token in JSON at position 2023 npm ERR! {"_id":"is-string","_rev":"8-a4a63ff60d8dba9a7e00bb773a5f6969" [...]
Not sure I'm in the right place to post this, but I didn't know where to post npm related issue.
Thanks.
This was a temporary issue from npm that seems to be resolved now.
is not working yet, must we do something special? @rizoom
Indeed, it appears that the issue is still present (npm 5.6.0)
$ npm view is-string dist.tarball npm ERR! registry error parsing json npm ERR! Unexpected token in JSON at position 2023
I have a private npm repository that proxy to npm official registry, so I manually published [email protected] in my private repo.
But I was pretty sure I also tested on npm registry before closing the issue.
+1
+1
This is not something i can possibly address; please email npm support for registry issues.
This issue was fixed for us when we updated node version, from node:7 to node:8. npm version was probably to old
I'm using Sonatype Nexus Repository Manager 3 as a proxy towards npmjs. That proxy got a stricter JSON validation lately, which causes to fail on is-string and also another library called protoduck (https://github.com/zkat/protoduck/issues/6). My assumption is, that a call on https://registry.npmjs.org/is-string will return a JSON with at least on control character, that is not supported by that stricter JSON validation. Concrete error message on the parser:
Caused by: com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 0)): has to be escaped using backslash to be included in string value at [Source: (BufferedInputStream); line: 1, column: 2103] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1798) [...]
I guess, that this issue can only be solved by pushing a new version on npmjs, that does not contain that control character.
Also having same issue with nexus. @ljharb I believe it's possible to address.
@ljharb Even if npm support can deal with it, they have to change the files, which lead to new hashes on an existing library version. This will break all builds that have lock files in place. We tested this approach by making a fixed copy of is-string on our nexus. It led to exact those inconsistency errors in regards to lock files.
From what I have seen it is necessary to push a new version to npm in order to fix this.
@cschweikert how can i reproduce this issue locally, and how can i locate that control character to ensure it's removed?
To be honest this seems like a bug in Nexus - if they started using a JSON validator that does not exactly match what npm uses, then it's broken.
I don't have any control characters in my local package.json nor in https://unpkg.com/[email protected]/package.json - so I'm not sure what republishing will achieve.
We are also facing a similar issue (intermittent). We have been able to repeat this without Nexus by visiting https://registry.npmjs.org/is-string directly (See screenshot below).
@RobertNorthard thanks, in that case it's probably a bug in npm itself. Can you file it on https://npm.community?
@ljharb looks like it is already been tracked as this issue is similar - https://npm.community/t/error-unexpected-token-in-json-at-position/5671/2
Closing in favor of the npm issue.
What helped me - publishing package to nexus manually eliminating '@' symbols from package.json. Looks like nexus package.json parser doesn't handle it correctly.
FYI, should be fixed now https://status.npmjs.org/incidents/06vhhrnp272c?u=qbb8hv50cs30&_ga=2.163989687.924804049.1552490030-888792057.1551259583