问题
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 sharp-cli@1.10.0
/Users/TuzMacbookPro2017/.npm-global/bin/sharp -> /Users/TuzMacbookPro2017/.npm-global/lib/node_modules/sharp-cli/bin/cli.js
+ sharp-cli@1.10.0
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 sharp-cli@1.10.0`.
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.
回答1:
Can you try installing sharp-cli@1.10.0
locally instead?
npm i -S sharp-cli@1.10.0
If that doesn't work I would try cleaning out your cache and trying again:
npm cache clean --force
Hopefully that helps!
来源:https://stackoverflow.com/questions/56979112/package-failing-to-be-found-after-successful-install