7

I have some strange issue regarding the package-lock.json. We are using npm 5.6 and node 8.9.2.

We have some project with dependencies. The developers can install the deps and push the package-lock.json as recommended:

     ...
                    "dependencies": {
                        "source-map": {
                            "version": "0.6.1",
                            "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
                            "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
                            "dev": true
                        }
                    }
    ...

They are getting their dependencies from https://registry.npmjs.org/.. Now we have some jenkins which gets its dependencies from some artifactory which serves as 'proxy' to https://registry.npmjs.org.

The build fails 75% of the times on some error like:

npm ERR! Unexpected end of JSON input while parsing near '...nalInternal" : {

Even when I clean the cache before with sudo npm clean cache --force (or remove .npm)

The error occurs always on a different place. Now when I remove the package-lock.json before starting the build it works well every time.

A new package-lock.json is generated. It contains not the registry urls but the artifactory urls (https://artifactory/xxx). I thought it could maybe have to do with it. so I replaced the current package-lock.json in git with the one from jenkins. I tried again but again the same error and issue, only deleting the package-lock.json seems to solve it but as I read it's not recommended to ignore this file.

What could be an issue?

DenCowboy
  • 13,884
  • 38
  • 114
  • 210

0 Answers0