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 pack' after using shrinkpack produces an unusable tarball

See original GitHub issue

Steps to Reproduce

Follow the shrinkpack-demo from the main page.

After the last step where the “co-worker” has run npm install, follow these steps in the “co-worker’s” directory.

npm pack

This will produce a file called shrinkpack-demo-1.0.0.tgz.

Move this shrinkpack-demo-1.0.0.tgz to a clean directory and then run:

npm install shrinkpack-demo-1.0.0.tgz

You will see the following error:

npm install shrinkpack-demo-1.0.0.tgz
npm WARN package.json shrinkpack-demo@1.0.0 No description
npm WARN package.json shrinkpack-demo@1.0.0 No repository field.
npm WARN package.json shrinkpack-demo@1.0.0 No README data
npm ERR! addLocal Could not install C:\source\sandbox\shrinkpack-bug-demo\clone\shrinkpack-bug-demo\tarball\nod
e_shrinkwrap\async-2.0.1.tar
npm ERR! addLocal Could not install C:\source\sandbox\shrinkpack-bug-demo\clone\shrinkpack-bug-demo\tarball\nod
e_shrinkwrap\commander-2.7.1.tar
npm ERR! addLocal Could not install C:\source\sandbox\shrinkpack-bug-demo\clone\shrinkpack-bug-demo\tarball\nod
e_shrinkwrap\express-4.14.0.tar
npm ERR! addLocal Could not install C:\source\sandbox\shrinkpack-bug-demo\clone\shrinkpack-bug-demo\tarball\nod
e_shrinkwrap\lodash-4.15.0.tar
npm ERR! addLocal Could not install C:\source\sandbox\shrinkpack-bug-demo\clone\shrinkpack-bug-demo\tarball\nod
e_shrinkwrap\request-2.74.0.tar
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\
bin\\npm-cli.js" "install" "shrinkpack-demo-1.0.0.tgz"
npm ERR! node v4.4.0
npm ERR! npm  v2.14.20
npm ERR! path C:\source\sandbox\shrinkpack-bug-demo\clone\shrinkpack-bug-demo\tarball\node_shrinkwrap\async-2.0
.1.tar
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\source\sandbox\shrinkpack-bug-demo\clone\shrinkpack
-bug-demo\tarball\node_shrinkwrap\async-2.0.1.tar'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     C:\source\sandbox\shrinkpack-bug-demo\clone\shrinkpack-bug-demo\tarball\npm-debug.log

The problem appears to be that it is expecting to find the node_shrinkwrap folder in the current directory as in the directory npm is run from. When install a tarball created using npm however the directory that it is installed to will be more like node_modules/shrinkpack-demo/node_shrinkwrap

Expecting: ./node_shrinkwrap/ Actual: ./node_modules/shrinkpack-demo/node_shrinkwrap

Node Version: 4.4.0 NPM Version: 2.14.20

npm-debug.log attached. npm-debug-log.txt

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
SamFarringtoncommented, Aug 16, 2016

I was going down the route of bundledDependencies before I came across shrinkpack - my (very limited and quite possibly incorrect) understanding of bundledDependencies is that you may hit issues when working cross-platform - i.e. package on windows and deploy on linux as it’s the node_modules folder that gets passed about and therefore that may contain platform-specific variations of dependencies.

For the record my current workaround for this issue is to manually archive the application using zip or tar rather than using npm pack and the unarchiving on the target server and running npm install in the extracted folder.

This workaround however just feels a little inelegant given the existence of npm pack

0reactions
JamieMasoncommented, Aug 25, 2016

Sorry for the delay, I have updated the README to try and better explain how shrinkpack works currently and the kinds of situations it can be used. Please let me know if this does not help and more should be done, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running npm install against a shrinkpacked project pushes ...
shrinkpack detects that some of the dependencies resolve to tarballs in npm_shrinkwrap/ and exits explaining that it has nothing to do. I think ......
Read more >
npm-pack
Create a tarball from a package. ... Enable running a command in the context of the configured workspaces of the current project while...
Read more >
How does npm run build work with npm pack? - Stack Overflow
npm pack basically "create a tarball from a package", but here is the deal: the "package" that it creates a tarball from has...
Read more >
Best practices for creating a modern npm package - Snyk
In this tutorial, we're going to walk step by step through creating an npm package using modern best practices (as of 2022).
Read more >
How to Work with NPM Packages Locally Using .tgz Files
This will ensure that what would get included in a usual publish process will be what you package up to install locally. Run...
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