torusresearch / eccrypto

Creative Commons Zero v1.0 Universal
9 stars 6 forks source link

Module not found: Can't resolve './build/Release/ecdh' #28

Closed billtlee closed 1 year ago

billtlee commented 2 years ago

Hi, I am trying to build my nextjs app and I am getting an error during the build saying:

./node_modules/@toruslabs/eccrypto/index.js Module not found: Can't resolve './build/Release/ecdh' in ...

Import trace for requested module: ./node_modules/@toruslabs/openlogin/dist/openlogin.cjs.js ./node_modules/@web3auth/ui/dist/ui.cjs.js ./node_modules/@web3auth/web3auth/dist/web3auth.cjs.js ./node_modules/moralis/lib/node/Web3Connector/Web3AuthConnector.js ./node_modules/moralis/lib/node/MoralisWeb3.js ./node_modules/moralis/lib/node/Parse.js ./node_modules/moralis/node.js ./pages/api/requestsForMint/admin/approveRequest.js ./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?absolute404Path=&absoluteAppPath=private-next-pages%2F_app.js&absoluteDocumentPath=private-next-pages%2F_document.js&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolutePagePath=private-next-pages%2Fapi%2FrequestsForMint%2Fadmin%2FapproveRequest.js&assetPrefix=&basePath=&buildId=dkX_Xles7wPxCQ6FZBLUB&canonicalBase=&distDir=private-dot-next&generateEtags=true&i18n=&loadedEnvFiles=W3sicGF0aCI6Ii5lbnYiLCJjb250ZW50cyI6Ik5FWFRfUFVCTElDX01BUktFVFBMQUNFPTB4MWY2NTY3MmNhNzY0ZTc0ODU5ODhGZUJhZUJDRWE0YzYwM2Q0NmFBMlxuTkVYVF9QVUJMSUNfTkZUPTB4OThENjZGMDA5MjliODU0OUFiQ0Y4RTE2NjFFOERlMjNhQWEyQ0E3N1xuXG5ORVhUX1BVQkxJQ19NT1JBTElTX0FQUF9JRD1YMExWTG1iU2FlQ2NhMUNRWjhwWjJXMjcydUxGQ1cyQjN4cEJzYjB5XG5ORVhUX1BVQkxJQ19NT1JBTElTX1NFUlZFUl9VUkw9aHR0cHM6Ly94cjBjc2NwOGRpYTkudXNlbW9yYWxpcy5jb206MjA1My9zZXJ2ZXJcbk5FWFRfUFJJVkFURV9NT1JBTElTX01BU1RFUl9LRVk9VldxNG5DaEl1ME5oTnlteVhVcXBpaWo3Y1piS0Q0Y25GOVhqeEs1SFxuTkVYVF9QVUJMSUNfU1VQUE9SVEVEX0NIQUlOX0lEPTRcbk5FWFRfTU9SQUxJU19NT05HT0RCX0lQPTE1OS4yMjMuMzMuMTQwOjU2NzI4XG5cbk5FWFRfUFVCTElDX0RVQUxNSU5UX0FQSV9VUkxfQkFTRT1odHRwczovL2FwaS5kZXYtYS5kcmFiYXlhc2hpLm5ldC9uZnRcbk5FWFRfUFVCTElDX0RVQUxNSU5UX0NPTlRSQUNUX05FVFdPUktfVVJMPWh0dHBzOi8vcmlua2VieS5pbmZ1cmEuaW8vdjMvMDQwYTM5Y2E5MTkzNDFhYTk5MmNmZTk4Yjc4MDQ1NmFcbiJ9XQ%3D%3D&page=%2Fapi%2FrequestsForMint%2Fadmin%2FapproveRequest&poweredByHeader=&previewProps=%7B%22previewModeId%22%3A%22e0508e6de012e1c7c3c6b866799ff345%22%2C%22previewModeSigningKey%22%3A%22d992cc567ceb0b5a4a8c8910770164191c845eba40d3faaf3724c8d940b759b1%22%2C%22previewModeEncryptionKey%22%3A%221d1df0db62f3847a685e40bc6511d33ea1559ecda01576f60d368f463e18dc9d%22%7D&runtimeConfig=!

ChewingGlass commented 2 years ago

Same issue here. It's because of a try/catch on an import. Just removed Torus from our wallet providers for now

ChewingGlass commented 2 years ago

This blew up in our docusaurus build, so it's not just nextjs. Seems to be webpack in general doesn't like it

josip-volarevic commented 1 year ago

@ChewingGlass just to confirm if I understand you correctly, removing Torus from wallet providers completely fixed the errors for you? If not, did you find another approach that would fix things?

nonfungible-dev commented 1 year ago

I was able to get around this issue by importing exactly the wallet adapters I needed; using the @solana/wallet-adapters-react library was importing torus, even if I wasn't using it.

-import {
-  GlowWalletAdapter,
-  PhantomWalletAdapter,
-  SolflareWalletAdapter,
-  SolletWalletAdapter,
-} from '@solana/wallet-adapter-wallets';
+import { GlowWalletAdapter } from '@solana/wallet-adapter-glow';
+import { PhantomWalletAdapter } from '@solana/wallet-adapter-phantom';
+import { SolflareWalletAdapter } from '@solana/wallet-adapter-solflare';
+import { SolletWalletAdapter } from '@solana/wallet-adapter-sollet';
josip-volarevic commented 1 year ago

@nonfungible-dev you sir are a blessing. Cheers 🍻

Kipperlenny commented 1 year ago
./node_modules/@toruslabs/eccrypto/index.js
Module not found: Can't resolve './build/Release/ecdh' in 'serverless-voting\node_modules\@toruslabs\eccrypto'

Import trace for requested module:
./node_modules/@toruslabs/openlogin/dist/openlogin.cjs.js
./node_modules/@web3auth/ui/dist/ui.cjs.js
./node_modules/@web3auth/web3auth/dist/web3auth.cjs.js
./node_modules/moralis/lib/browser/Web3Connector/Web3AuthConnector.js
./node_modules/moralis/lib/browser/MoralisWeb3.js
./node_modules/moralis/lib/browser/Parse.js
./node_modules/moralis/index.js
./node_modules/react-moralis/lib/index.cjs.js
./pages/_app.js
./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?absolute404Path=&absoluteAppPath=private-next-pages%2F_app.js&absoluteDocumentPath=private-next-pages%2F_document.js&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolutePagePath=next%2Fdist%2Fpages%2F_error&assetPrefix=&basePath=&buildId=XSo27jMX6Z4Izxkc_I-G6&canonicalBase=&distDir=private-dot-next&generateEtags=true&i18n=&loadedEnvFiles=W10%3D&page=%2F_error&poweredByHeader=true&previewProps=%7B%22previewModeId%22%3A%22944c42760d377e02763d657eebb76d9f%22%2C%22previewModeSigningKey%22%3A%22276c37ec480cc9574b755a962109582a976f81f6e11c803277af5f30af659b26%22%2C%22previewModeEncryptionKey%22%3A%22d7a54f63f83fe7ffe698103bc573504ab247b67d58c0b8de6e4c9c49cbbc2557%22%7D&runtimeConfig=!

same problem here with nextjs and moralis

chaitanyapotti commented 1 year ago

Resolved in v2.0.0