question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running npm install against a shrinkpacked project pushes the local file resolution into the npm cache.

See original GitHub issue

Expected behaviour

It should be possible to rerun shrinkpack if new dependencies have been added to an npm-shrinkwrap file. …

Actual behaviour

shrinkpack detects that some of the dependencies resolve to tarballs in npm_shrinkwrap/ and exits explaining that it has nothing to do.

I think this is the commit containing the faulty logic: https://github.com/JamieMason/shrinkpack/commit/409062cfb7b3ac53a7357de3a1e53bb116b9f054

Steps to reproduce

shrinkpack a project add a new dependency try to shrinkpack it again …

Software versions used

OS         :  Linux
node.js    :  v4.2.4
npm        :  v3.8.6
shrinkpack : 0.10.0

Log output when running shrinkpack

! npm-shrinkwrap.json is already shrinkpacked, update it using npm shrinkwrap --dev then try again

Contents of your npm-shrinkwrap.json or package.json

N/A

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:31 (22 by maintainers)

github_iconTop GitHub Comments

8reactions
marxiancommented, Apr 21, 2016

@lime has it.

Running npm install against a shrinkpacked project pushes the local file resolution into the npm cache. This affects later resolution of the same module, even in different, non-shrinkpacked projects.

Here’s an attempt at demonstrating the issue, sorry if it is hard to follow:

npm cache clean
mkdir test && cd test && npm init -f
npm install --save leftpad

grep -oP \"_resolved\":\".*?\" ~/.npm/leftpad/0.0.0/package/package.json
"_resolved":"https://registry.npmjs.org/leftpad/-/leftpad-0.0.0.tgz"

npm shinkwrap
shrinkpack
npm install

grep -oP \"_resolved\":\".*?\" ~/.npm/leftpad/0.0.0/package/package.json
"_resolved":"file:node_shrinkwrap/leftpad-0.0.0.tgz"

cd .. && mkdir test2 && npm init -f
npm install --save leftpad
npm shrinkwrap
cat npm-shrinkwrap.json
{
  "name": "test2",
  "version": "1.0.0",
  "dependencies": {
    "leftpad": {
      "version": "0.0.0",
      "from": "leftpad@latest",
      "resolved": "file:node_shrinkwrap/leftpad-0.0.0.tgz"
    }
  }
}

1reaction
JamieMasoncommented, Jul 25, 2016

of course, thanks @DrewML.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm-cache
This command is primarily intended to be used internally by npm, but it can provide a way to add data to the local...
Read more >
Using npm Packages - Meteor Guide
Installing npm packages. npm packages are configured in a package.json file at the root of your project. If you create a new Meteor...
Read more >
Best practices for creating a modern npm package - Snyk
Once your project is created, you can move on to creating an npm ... information to the public such as a local configuration...
Read more >
Publishing private NPM packages to Nexus - Level Up Coding
Creating NPM proxy and group; Pushing Binaries to Nexus; Pulling Binaries from Nexus; Conclusion. Running Nexus Repository Manager locally.
Read more >
npm install errors with Error: ENOENT, chmod - Stack Overflow
Ok it looks like NPM is using your .gitignore as a base for the .npmignore file, and thus ignores /lib . If you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found