JamieMason / shrinkpack

Fast, resilient, reproducible builds with npm install.
https://www.npmjs.com/package/shrinkpack
MIT License
793 stars 38 forks source link

npm install some-shrinkpacked-package #56

Closed aju closed 8 years ago

aju commented 8 years ago

Expected behaviour

Installing shrinkpacked module as dev dependency ...

Actual behaviour

Throws erros like: ENOENT: no such file or directory, open '/Users/anmaciur/Projects/kkk/node_modules/style-guide/node_shrinkwrap/abbrev-1.0.9.tgz' ...

Steps to reproduce

Hi I have a project https://github.com/brainly/style-guide/tree/v44.0.1 that I want to install as dependency. Running command: npm i git+https://github.com/brainly/style-guide.git#v44.0.1 throws erros like: ENOENT: no such file or directory, open '/Users/anmaciur/Projects/kkk/node_modules/style-guide/node_shrinkwrap/abbrev-1.0.9.tgz' ...

Software versions used

OS         :  OSX
node.js    :  6.2.2
npm        : 3.10.4 (I tried on older versions as well 3.8.0)
shrinkpack : 0.13.1

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

https://github.com/brainly/style-guide/blob/v44.0.1/package.json https://github.com/brainly/style-guide/blob/v44.0.1/npm-shrinkwrap.json

JamieMason commented 8 years ago

I'm on a train now but that looks like the npm issue in #45, can you verify you're definitely on 3.10.4?

aju commented 8 years ago

I installed it today using sudo npm install -g npm@3.10.4 previously I was on 3.8.7 and it was not working as well. In my shripkwrap file i have paths like ./ shouldn't it be like file: ??

JamieMason commented 8 years ago

Can you try: npm cache clear, delete shrinkwrap JSON, run shrinkwrap, run shrinkpack?

aju commented 8 years ago

I did try it as well :( - please try running npm i git+https://github.com/brainly/style-guide.git#v44.0.1 in empty folder.

JamieMason commented 8 years ago

Damn, sorry about this. I am away until the weekend but will look into it and arrange a fix once I'm back.

aju commented 8 years ago

Thank you for fast replay :)

brutuscat commented 8 years ago

I got this fixed using npm npm >= 3.10.4

aju commented 8 years ago

@brutuscat are you able to run npm i git+https://github.com/brainly/style-guide.git#v44.0.1 ??

brutuscat commented 8 years ago

@aju no sorry, I was referring to the issue of npm ERR! addLocal Could not install when running npm install from a shrinkpack-ed repo... #41. I'll make my comment invalid to avoid confusion.

Arkotek commented 8 years ago

Same here, I cannot install a shrinkpacked module, globally and locally, I always get thesed errors:

npm ERR! addLocal Could not install /root/.nvm/versions/node/v4.4.4/lib/node_modules/sample-scrap/node_shrinkwrap/xtend-4.0.1.tgz
[...]
npm ERR! enoent ENOENT: no such file or directory, open '/root/.nvm/versions/node/v4.4.4/lib/node_modules/sample-scrap/node_shrinkwrap/ansi-regex-2.0.0.tgz'

Versions:

root@master: ~
>>> node -v
v4.4.4

root@master: ~
>>> npm -v
3.10.5

root@master: ~
>>> shrinkpack --version
0.13.1
JamieMason commented 8 years ago

@aju (/cc @Arkotek)

I just ran the following and everything worked;

git clone https://github.com/brainly/style-guide.git
cd style-guide/
npm i
npm shrinkwrap --dev
shrinkpack
rm -rf node_modules/
npm i

However, I think I know what the problem is npm install some-shrinkpacked-package will not work. I realise now from your https://github.com/JamieMason/shrinkpack/issues/56#issuecomment-231029833 that this is what you were trying to do.

This is the fault of unclear documentation on my part (which I will improve) but in summary.

Shrinkpack is not intended for use in packages published to the registry;

Please let me know of any questions/concerns, or if anything is not clear, so I can take it into account when explaining this in the docs.

Thanks all.

aju commented 8 years ago

Hi Thanks for the information. Do you have any future plans to make it work for dependent packages ?

aju commented 8 years ago

BTW when I added just npm-shrinkpack.json to style guide repo it did't work as well when used with root project that was using shrinkpack :(

JamieMason commented 8 years ago

Thanks for the information. Do you have any future plans to make it work for dependent packages?

For the reasons in https://github.com/JamieMason/shrinkpack/issues/56#issuecomment-231663704 I don't think it's right that packages published to the registry bundle their dependencies in this way.

BTW when I added just npm-shrinkpack.json to style guide repo it did't work as well when used with root project that was using shrinkpack :(

You'll also need the node_shrinkwrap/*.tgz and be sure that npm-shrinkwrap.json and everything else is up to date with your latest dependency graph. Your style-guide project should work as I ran it earlier this morning.