Quasar Framework (VueJS) - "UI" compiles with errors (if importing web3)
P粉785957729
P粉785957729 2024-02-21 11:32:57
0
1
522

I am using Quasar CLI version 1.2.1 and library web3 version ^1.5.2

An error occurred when I used it:

import Web3 from 'web3'

Log error:

Application • Link "UI" Webpack Configure Application • Wait • Compile "UI" In progress... Application • Complete • "UI" compiled with errors • 6809ms

Application•Error•UI is located in ./node_modules/cipher-base/index.js

Module not found: Unable to resolve imported dependency 'stream', are you? Forgot to install it? You can run: yarn add stream

Application•Error•UI is located in ./node_modules/eth-lib/lib/bytes.js

Module not found: Unable to resolve imported dependency 'crypto'? Forgot to install it? You can run: yarn add crypto

Application • Errors • User Interface ./node_modules/ethereumjs-util/dist.browser/account.js

Module not found: Unable to resolve imported dependency 'assert'? Forgot to install it? You can run: yarn add assert

Application • Errors • User Interface ./node_modules/swarm-js/node_modules/eth-lib/lib/bytes.js

Module not found: Unable to resolve imported dependency 'crypto'? Forgot to install it? You can run: yarn add crypto

Application • Errors • User Interface ./node_modules/web3-eth-accounts/lib/index.js

Module not found: Unable to resolve imported dependency 'crypto'? Forgot to install it? You can run: yarn add crypto

Application • Errors • User Interface ./node_modules/web3-providers-http/lib/index.js

Module not found: Unable to resolve imported dependency 'http', are you? Forgot to install it? You can run: yarn add http

Application • Errors • User Interface ./node_modules/web3-providers-http/lib/index.js

Module not found: Unable to resolve imported dependency 'https'? Forgot to install it? You can run: yarn add https

Application • Errors • User Interface ./node_modules/xhr2-cookies/dist/xml-http-request.js

Module not found: Unable to resolve imported dependency 'http', are you? Forgot to install it? You can run: yarn add http

Application • Errors • User Interface ./node_modules/xhr2-cookies/dist/xml-http-request.js

Module not found: Unable to resolve imported dependency 'https'? Forgot to install it? You can run: yarn add https

Application • Errors • User Interface ./node_modules/xhr2-cookies/dist/xml-http-request.js

Module not found: Unable to resolve imported dependency 'os'? Forgot to install it? You can run: yarn add os

Application • Compilation failed • Please check the log above for details.

P粉785957729
P粉785957729

reply all(1)
P粉748218846

You are trying to use the nodejs module in your browser.

If you read the documentation carefully, it says:

So what you need to do is: import Web3 from 'web3/dist/web3.min.js'

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template