Closed mbykov closed 4 months ago
Hi, You should be able to do this, it is the recommended way to install ~syncpack~ shrinkpack.
Let's install ~syncpack~ shrinkpack into a brand new, empty Node.js project;
# make some throw away folder
mkdir temp
# navigate to it
cd temp
# turn it into a Node.js project
npm init -y
# install syncpack
npm install --save-dev shrinkpack
What happens when you run these commands? (Or the equivalent commands if you are on Windows).
temp> npm install --save-dev syncpack ? Why syncpack? temp> npm install --save-dev syncpack 130 ... up to date, audited 244 packages in 2s .... temp> npm install --save-dev shrinkpack ... added 145 packages, and audited 244 packages in 6s
temp> ./node_modules/.bin/shrinkpack node_modules - (I run it locally) ! no package-lock.json or npm-shrinkwrap.json found
Why syncpack?
My mistake, I had just been replying to issues on my other project syncpack before replying to you.
It is saying that "no package-lock.json or npm-shrinkwrap.json found", this could be because those files do not exist in the temp
directory.
If you run ls -lah
in the temp directory, what is listed?
Jamie, ls -la is ok. I've done a dozen of tests
temp> ls -la итого 116 drwxr-xr-x 3 michael michael 4096 мая 7 21:08 . drwxr-xr-x 9 michael michael 4096 мая 7 21:07 .. drwxr-xr-x 198 michael michael 4096 мая 7 21:09 node_modules -rw-r--r-- 1 michael michael 301 мая 7 21:09 package.json -rw-r--r-- 1 michael michael 101553 мая 7 21:13 package-lock.json
Thanks @mbykov, I just tried it myself and it all seemed to work
BUT, I just noticed something, you are running the command on the node_modules
directory but it should be run against the root of your project like so.
- ./node_modules/.bin/shrinkpack node_modules
+ ./node_modules/.bin/shrinkpack .
I think if you make that change it should be ok.
Yes, great! So:
$ npm i shrinkpack (locally) $ ./node_modules/.bin/shrinkpack . (<- this . does the trick!)
Thank you!
You're welcome 👍 I've not worked on shrinkpack for a long time, so you may run into issues if anything major has changed in npm since then.
Description
I can not install shrinkpack without --global option, but I have to.
Suggested Solution
Help Needed
May be there is some method how to install and use shrinkpack locally?
When I have tried, it wrote "no package-lock.json or npm-shrinkwrap.json found"
If I create a symlink to /usr/local/bin, it wrote the same