arei / npmbox

Utility for creating (boxing) and using (unboxing) an archive of a complete (including all dependencies) npm install.
MIT License
245 stars 34 forks source link

Unboxing multiple npmbox files at once fails. #36

Closed tinklern closed 8 years ago

tinklern commented 9 years ago

Whenever I attempt to unbox multiple npmbox archives with a single command:

npmunbox jshint.npmbox adm-zip.npmbox browserify.npmbox ... etc

Locker.js is throwing what appears to be a permissions error.

Unboxing ../adm-zip.npmbox...
Unpacking ../adm-zip...
Installing ../adm-zip...
[project path]/node_modules/npmbox/node_modules/npm/lib/utils/locker.js:64
    throw new Error(
          ^
Error: Attempt to unlock [project path]/node_modules/adm-zip, which hasn't been locked

However, simply unboxing each archive one at a time appears to work fine:

npmunbox jshint.npmbox && npmunbox adm-zip.npmbox && npmunbox browserify.npmbox ... etc

I've seen several similar reported failures in npm due to permission errors, however I've tried every combination of permissions on the archives I can think of. I also can't explain why the process only fails if multiple archives are being unboxed at once but works fine if each is unboxed separately.

This isn't a deal breaker, but it makes it much harder to load a lot of thirdparty libraries because a simple npmunbox *.npmbox fails. So the build script must be aware of every third party dependency path, which is nasty.

tinklern commented 9 years ago

Some additional details: npm: 2.10.1 node: v0.12.4 OSX Yosemite: 10.10.2 (14C1514)

This only happens when I install npmbox from a .npmbox file. I'm using the following commands to install npmbox (and nothing appears to fail during this process)

tar --no-same-owner --no-same-permissions -xf ../npmbox.npmbox -C ./temp
npm install --cache ./temp/.npmbox.cache --optional --cache-min 99999 --shrinkwrap false npmbox

As far as I can tell, the only difference is that I'm opting to not install npmbox globally. Both of these commands complete successfully.

I'm planning on testing a global install to see if the issue persists.

arei commented 8 years ago

So, in my very small test I had no problem, but I do have npmbox installed globally, so it could be related. Could also be related to running npmbox in the same path as you are trying to npmunbox in, which means they are sharing a node_modules folder.

Did you have any success with installing globally?

arei commented 8 years ago

This is fixed in 3.1.1.