-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Cannot find module" issue (React-Native) #330
Comments
I will look into this once I get to a coffee shop today. That seems odd, to say the least. :s |
Oh! So, I've been trying to get the plugin to build for the last little bit (seems there re some dependencies not included in the package.json). Is this a react app? React seems to hijack the name Basically, can you try |
Yes it is a react app, and it helped with your require("ethers/dis/ethers.min.js") solution! However, in my case, I am not using ethers directly, but some dependent lib are using it, it would be tricky for me to manipulate the dependency. |
The new version points to the minified version directly, so it should work out of the box. You may have to pull in the React-Native shims though: // Import the required shims
import 'ethers/dist/shims.js';
// Import the ethers library
import { ethers } from 'ethers'; Notes: https://docs.ethers.io/ethers.js/html/cookbook-react.html |
thanks for the fix! |
Worked fine with 3.x.x, but recently switched to 4.x.x, I got a lot of "Cannot find module" error.
Here is my step to reproduce this issue:
1.checkout metamask repository
git clone https://github.com/MetaMask/metamask-extension.git
2.
cd metamask-extension
nvm use
npm install
npm install [email protected]
3. adding usage of ethers, for eg, add a line in "ui/index.js"
const ethers = require('ethers')
4. This works fine
npm start
5. Install new version
npm install [email protected]
6. And this fails
npm start
I got a lot of message like:
Error: Cannot find module './utils/bignumber' from '/Users/xx/workspace/js/metamask-extension/node_modules/ethers/dist' at /Users/xx/workspace/js/metamask-extension/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21 at load (/Users/xx/workspace/js/metamask-extension/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43) at onex (/Users/xx/workspace/js/metamask-extension/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31) at /Users/xx/workspace/js/metamask-extension/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47 at FSReqWrap.oncomplete (fs.js:152:21)
I guess it starts from this commit, where many path is changed:
f4dd5d1
The text was updated successfully, but these errors were encountered: