Running 'npm pack' after using shrinkpack produces an unusable tarball
See original GitHub issueSteps 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:
- Created 7 years ago
- Comments:5 (3 by maintainers)
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 runningnpm install
in the extracted folder.This workaround however just feels a little inelegant given the existence of
npm pack
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.