Closed neonexus closed 11 months ago
Ok, so this is a bit odd... I discovered that if I have @ngrok/ngrok
listed in optionalDependencies
and npm i --optional
, then it installs everything correctly:
But, if I npm i @ngrok/ngrok --save-dev
, then only the main package is installed, none of the native bindings come along (same behavior when installed in dependencies
):
EDIT: When it's in devDependencies
(or dependencies
), and I run npm i --optional
, it does install everything. This is a problem, as this would require --optional
on EVERY npm install
, regardless of the level of requirement.
Ok, I finally figured out my problem... My .npmrc
file had omit=optional
in it...
Closing...
Thanks for bringing attention to this and documenting the steps as you figured it out @neonexus ❤️ I'm sure others will find this useful if they run into the same issue.
Maybe there is something we can do here to make this clearer and easier for users.
@nijikokun Something that might be a good / helpful change, is wrapping the native bindings require
calls in a big try / catch; that way if something isn't installed (like with my case), then the package can throw out an error like "could not load native bindings... Are you excluding optional dependencies?"...
I'm trying to move away from
ngrok
to the official@ngrok/ngrok
package in my main open-source repo (sails-react-bootstrap-webpack). Just seems like the prudent move. However, right off the bat, I ran into an issue withrequire('@ngrok/ngrok')
...I am attempting to run this on my old Mac mini 2012. That I don't believe would be the issue. The issue, is more likely because I managed to find a way to run macOS Sonoma (most recent major version) on my mini (this particular model of Mac mini has been unsupported by Apple for years now).
Now, that all said, I don't know why the package wouldn't have installed
@ngrok/ngrok-darwin-x64
when it is clearly detecting the arch correctly...Someone, please help!