Package failing to be found after successful install
Asked Answered
L

1

1

I try to run expo optimize and it says it requires sharp-cli.

So I install sharp-cli as it directs.

And then it gives me the same error.

(first step described above is left out)

$ npm install -g [email protected]
/Users/TuzMacbookPro2017/.npm-global/bin/sharp -> /Users/TuzMacbookPro2017/.npm-global/lib/node_modules/sharp-cli/bin/cli.js
+ [email protected]
updated 1 package in 24.632s
$ expo optimize
This will overwrite the original assets.
Optimizing assets...
Optimizing ./assets/electro-icon-1024.png
This command requires version 1.10.0 of `sharp-cli`. 
You can install it using `npm install -g [email protected]`. 

For prerequisites, see: https://sharp.dimens.io/en/stable/install/#prerequisites
Set EXPO_DEBUG=true in your env to view the stack trace.

This was happening before and I was able to fix it by restarting my terminal, or something like that. No such luck this time.

Also if it helps, expo-cli tells me there's a new version when I run an expo command, no matter how many times I install the new version. Similar problem, it seems.

Installing with yarn global add didn't fix it either.

Lohner answered 10/7, 2019 at 21:51 Comment(0)
P
1

Can you try installing [email protected] locally instead?

npm i -S [email protected]

If that doesn't work I would try cleaning out your cache and trying again:

npm cache clean --force

Hopefully that helps!

Planometer answered 10/7, 2019 at 22:8 Comment(9)
Thanks. That second command warns, "I sure hope you know what you're doing." I don't. Should I take any precautions before doing this?Lohner
@JonathanTuzman I would try installing the sharp-cli locally first then rerunning expo optimize. npm cache clean will delete the data stored in npm's cached folder. Alternatively, you can run npm cache verify and if no issues are reported then the integrity of your cached data is fine. CheersPlanometer
I tried the local install with no luck. I'll try cleaning and verifying the cache and report back. Thanks for the help.Lohner
Whelp, after cleaning and verifying, trying npm install -g [email protected] gives me a cb() never called error, along with an EACCES permission denied error, so I ran it as sudo, and expo optimize still doesn't work.Lohner
what's the stack trace?Planometer
Check that your npm prefix location is on your system's path. If you installed the module globally and it's still not recognized that could be the reason: #57298727Planometer
same problem here, i tried all the suggestions here and expo optimize throws the same error. :/Mule
expo optimize has been removed from expo command line interface. I'm not familiar with sharp-cli otherwise i'd chime in, however... I have had issues related to permissions being denied while installing globally. After taking a look at more closely I found that some packages were owned by admin, some staff, some root, some me. Rather that foul with it at all I just manuall force deleted the directory and when reinstalled after clearing cache, etc, it installed perfecto.Algeciras
You can do npx expo-optimize now @AdrianoMichaelBassarisk

© 2022 - 2024 — McMap. All rights reserved.