is-string icon indicating copy to clipboard operation
is-string copied to clipboard

Package not accessible from npm

Open rizoom opened this issue 7 years ago • 18 comments

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.

rizoom avatar Feb 25 '19 10:02 rizoom

This was a temporary issue from npm that seems to be resolved now.

rizoom avatar Feb 25 '19 11:02 rizoom

is not working yet, must we do something special? @rizoom

tomcask avatar Feb 25 '19 11:02 tomcask

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.

rizoom avatar Feb 25 '19 14:02 rizoom

+1

m-apsolon avatar Feb 25 '19 16:02 m-apsolon

+1

cschweikert avatar Feb 25 '19 16:02 cschweikert

This is not something i can possibly address; please email npm support for registry issues.

ljharb avatar Feb 25 '19 17:02 ljharb

This issue was fixed for us when we updated node version, from node:7 to node:8. npm version was probably to old

gson88 avatar Feb 26 '19 08:02 gson88

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.

cschweikert avatar Feb 26 '19 10:02 cschweikert

Also having same issue with nexus. @ljharb I believe it's possible to address.

vanyadymousky avatar Feb 26 '19 11:02 vanyadymousky

@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 avatar Feb 26 '19 11:02 cschweikert

@cschweikert how can i reproduce this issue locally, and how can i locate that control character to ensure it's removed?

ljharb avatar Feb 26 '19 22:02 ljharb

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.

ljharb avatar Feb 26 '19 22:02 ljharb

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).

screen shot 2019-02-26 at 22 46 25

RobertNorthard avatar Feb 26 '19 22:02 RobertNorthard

@RobertNorthard thanks, in that case it's probably a bug in npm itself. Can you file it on https://npm.community?

ljharb avatar Feb 26 '19 22:02 ljharb

@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

RobertNorthard avatar Feb 26 '19 22:02 RobertNorthard

Closing in favor of the npm issue.

ljharb avatar Feb 26 '19 23:02 ljharb

What helped me - publishing package to nexus manually eliminating '@' symbols from package.json. Looks like nexus package.json parser doesn't handle it correctly.

vanyadymousky avatar Feb 27 '19 06:02 vanyadymousky

FYI, should be fixed now https://status.npmjs.org/incidents/06vhhrnp272c?u=qbb8hv50cs30&_ga=2.163989687.924804049.1552490030-888792057.1551259583

rizoom avatar Mar 13 '19 15:03 rizoom