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

npm 5 install corrupts package-lock.json #17081

Open
12 tasks
benmccann opened this issue Jun 8, 2017 · 13 comments
Open
12 tasks

npm 5 install corrupts package-lock.json #17081

benmccann opened this issue Jun 8, 2017 · 13 comments

Comments

@benmccann
Copy link

benmccann commented Jun 8, 2017

I'm opening this issue because:

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

What's going wrong?

The first time I run npm install it outputs:

        "has-unicode": {
          "version": "file:../has-unicode",

The second time I run npm install it outputs:

        "has-unicode": {
          "version": "file:file:../has-unicode",

The third time I run npm install it crashes:

npm ERR! path file:../has-unicode/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open 'file:../has-unicode/package.json'
npm ERR! package.json npm can't find a package.json file in your current directory.

How can the CLI team reproduce the problem?

NOTE: I have fixed gitbook-cli so that it no longer causes this problem. The following reproduction steps will no longer work because Chart.js will now pull in the fixed gitbook-cli 2.3.1 instead of gitbook-cli 2.3.0

git clone https://github.com/chartjs/Chart.js.git
cd Chart.js
npm install
npm install
npm install

supporting information:

  • npm -v prints: 5.0.2
  • node -v prints: v6.10.2
  • npm config get registry prints: https://registry.npmjs.org/
  • Windows, OS X/macOS, or Linux?: Linux
  • 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).
@bigardone
Copy link

Same issue here using npm 5.0.3

@amartinelli6577
Copy link

I'm also seeing the same issue on npm 5.0.3

@babak1199
Copy link

babak1199 commented Jul 2, 2017

Had the same issue - npm 5.0.3

Came across a potentially invalid entry in package-lock.json like this

"has-unicode": {
  "version": "file:file:..\\has-unicode",
  "integrity": "sha1-o82Wwwe6QdVZxaLuQIwSoRxMLsM=",
  "dev": true
},

Removing it apparently solved my problem. Do you have any idea why it has been created?

@billyjacobs2014
Copy link

I am having the same problem. Hopefully there will be a permanent fix for this soon instead of having to remove that section noted in the previous post.

@rdlowe7921
Copy link

IF this feature would work as intended, it could eliminate many of the challenges associated with building our code. I sure hope this bug receives some attention soon...

@ppator1
Copy link

ppator1 commented Jul 3, 2017

Our developers are currently having to run a pre-install script to delete the package-lock.json as a work around to this bug. We would love to have it working correctly so we can avoid having to do such work arounds.

@daleb77
Copy link

daleb77 commented Jul 3, 2017

Using npm 5.0.3 and am having the same issue.

@DexterHaslem
Copy link

Running into this as well on npm 5.0.2

@sgantrim
Copy link

sgantrim commented Jul 5, 2017

Same issue here - npm 5.0.3

@legodude17
Copy link
Contributor

I cannot reproduce this on npm@5.0.4 Try updating to that version.

@rdlowe7921
Copy link

Upgrading to 5.1 appears to fix this problem for us. Thank you!

@benmccann
Copy link
Author

benmccann commented Jul 10, 2017

It still seems to be broken for me on 5.1. It looks like the problem in my case is that Chart.js is pulling in old packages via gitbook-cli

@benmccann
Copy link
Author

gitbook-cli has been fixed such that it no longer causes this issue

I'm not sure whether this is really a bug in npm. It seems like the real issue was a malformed version attribute on one of the packages used in my build. In my case there was a newer version of has-unicode without the malformed version attribute, so I was able to pull in a fixed version of that package by upgrading gitbook-cli to depend on npm 5 instead of npm 3.

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

No branches or pull requests