使用thirdweb3启动项目时遇到问题

问题描述 投票:0回答:1

当我尝试使用 windowsWSL 在 Visula Studico Code 中安装thirdweb 时,遇到了一些问题。

运行的命令是 npxthirdweb@latest create --contract。

终端弹出:

node:internal/modules/cjs/loader:1143
  throw err;
  ^

Error: Cannot find module '@walletconnect/auth-client'
Require stack:
- /home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@walletconnect/web3wallet/dist/index.cjs.js
- /home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/wallets/dist/thirdweb-dev-wallets.cjs.dev.js
- /home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/wallets/dist/thirdweb-dev-wallets.cjs.js
- /home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/auth/dist/auth-1db3810e.cjs.dev.js
- /home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/auth/dist/thirdweb-dev-auth.cjs.dev.js
- /home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/auth/dist/thirdweb-dev-auth.cjs.js
- /home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/cli/dist/cli/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@walletconnect/web3wallet/dist/index.cjs.js:1:75)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@walletconnect/web3wallet/dist/index.cjs.js',
    '/home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/wallets/dist/thirdweb-dev-wallets.cjs.dev.js',
    '/home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/wallets/dist/thirdweb-dev-wallets.cjs.js',
    '/home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/auth/dist/auth-1db3810e.cjs.dev.js',
    '/home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/auth/dist/thirdweb-dev-auth.cjs.dev.js',
    '/home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/auth/dist/thirdweb-dev-auth.cjs.js',
    '/home/seekeye/.npm/_npx/1b718c59dfba7034/node_modules/@thirdweb-dev/cli/dist/cli/index.js'
  ]
}

Node.js v18.20.2

另外,我尝试了命令 npxthirdweb install 和其他指定其网页的命令,但没有解决问题 - 我是新手,有人可以帮助我吗?

非常感谢。

npxthirdweb@latest create --contract

npx ThirdWeb 安装
npm i -S @walletconnect/sign-client

npm install -g npm

blockchain web3js thirdweb
1个回答
0
投票

如果您已经有一个项目(带有

package.json
)并且想要在其中安装
thirdweb
,请使用
npx thirdweb install
,否则使用
npx thirdweb create

我刚刚尝试了

npx thirdweb create
npx thirdweb create --contract
,两者都工作正常:

npx thirdweb create --contract

    $$\     $$\       $$\                 $$\                         $$\       
    $$ |    $$ |      \__|                $$ |                        $$ |      
  $$$$$$\   $$$$$$$\  $$\  $$$$$$\   $$$$$$$ |$$\  $$\  $$\  $$$$$$\  $$$$$$$\  
  \_$$  _|  $$  __$$\ $$ |$$  __$$\ $$  __$$ |$$ | $$ | $$ |$$  __$$\ $$  __$$\ 
    $$ |    $$ |  $$ |$$ |$$ |  \__|$$ /  $$ |$$ | $$ | $$ |$$$$$$$$ |$$ |  $$ |
    $$ |$$\ $$ |  $$ |$$ |$$ |      $$ |  $$ |$$ | $$ | $$ |$$   ____|$$ |  $$ |
    \$$$$  |$$ |  $$ |$$ |$$ |      \$$$$$$$ |\$$$$$\$$$$  |\$$$$$$$\ $$$$$$$  |
    \____/ \__|  \__|\__|\__|       \_______| \_____\____/  \_______|\_______/ 

💎 thirdweb v0.13.80 💎

✔ What is your project named? … thirdweb-contracts
✔ What framework do you want to use? › Hardhat
✔ What will be the name of your new smart contract? … MyContract
✔ What type of contract do you want to start from? › Empty Contract
Creating a new thirdweb contracts project in /.../thirdweb-contracts.

Downloading files. This might take a moment.
Installing packages. This might take a couple of minutes.

...

Success! Created thirdweb-contracts at /.../thirdweb-contracts

过去的版本存在一些问题,但我不确定您尝试时的

latest
是什么版本,所以尝试使用
npx [email protected] create

否则,可能是 NPM 的本地问题。尝试:

rm -rf node_modules package-lock.json
npm cache clear --force
npm install
npx thirdweb create
© www.soinside.com 2019 - 2024. All rights reserved.