当前位置:网站首页>Dfinity (ICP) development problems and solutions-6
Dfinity (ICP) development problems and solutions-6
2022-06-13 08:00:00 【Boiled soybeans in brine】
Dfinity Develop problems and solutions
This section provides information to help you troubleshoot and troubleshoot or workaround common problems related to the following tasks :
- Download and install DFINITY Canister SDK
- establish 、 Build or deploy containers
- Use
dfxCommand line interface - Run locally in the development environment Internet computer network
Ensure that nodes are available in the project
Because the project depends on webpack Provides a framework for the default front end , So you must have node.js It is installed in your development environment and can be accessed in the project directory .
If you want to use the default webpack Develop your project with configuration and container aliases , You can
assetsfromdfx.jsonDelete the container from the file or build your project with a specific container name . for example , You can choose to build only by running the following command hello Program , Without front-end assets :dfx build helloIf you use the default webpack Configure and run
dfx buildFailure , You should trynpm installRun in the project directory and rerundfx build.If
npm installRunning in the project directory does not solve the problem , You should checkwebpack.config.jsWhether there is syntax error in the configuration of the file
Migrate existing projects
at present , You may use a previous version of dfx None of the projects created by the command line interface have automatic migration or backward compatibility . After upgrading to the latest version , If you try to build or install using a previous version of dfx The project created by the command line interface , You may see error or failure messages .
however , in many instances , You can change... Manually dfx.json In the configuration file dfx Set up , Then rebuild the project to work with dfx You currently have a command line interface version that is compatible with , To continue to use the project installation in the previous version .
for example , If you have one to use dfxversion Project created , In the text editor 0.4.9 Open the dfx.json Document and will dfx Change the settings to the latest version or delete the section completely .
Restart local Internet computer network
In some cases , Due to replication status error , Start locally Internet The computer network will fail . If it's running dfx start Start a local Internet There was a problem with the computer network :
In the terminal that displays the network operation , Press Control-C Interruptible local network processes .
Stop... By running the following command Internet computer network :
dfx stopBy running the following command , Restart in a clean state Internet Computer :
dfx start --cleanThe
--cleanOption removes checkpoints and stale status information from your project cache , So that you can restart in a clean state Internet Computer copy and Web Server process .
But remember , If you reset the status information by running dfx start --clean, Your existing container will also be deleted .
After operation dfx start --clean, Recreate your container by running the following command :
dfx canister create --all
dfx build
dfx canister install --all
Delete easy Directory
If you are successfully connected to Internet There was a problem building or deploying the container after the computer registered the container identifier , You should canisters Delete the directory before attempting to rebuild or redeploy the container .
You can canisters Delete the project directory by running the following command in the project root directory :
rm -rf ./.dfx/* canisters/*
reinstall dfx
Many of the errors you may encounter can be uninstalled and reinstalled dfx Command line interface to solve . There are several ways to reinstall dfx.
If you dfx Only one version is installed in the development environment of , You can usually run the following command to uninstall and reinstall the latest version of dfx:
~/.cache/dfinity/uninstall.sh && sh -ci "$(curl -sSL https://sdk.dfinity.org/install.sh)"
If you modify dfx Location of binaries , You may need to run the following command to uninstall dfxPATH Version in , Then reinstall the latest version dfx:
rm -rf ~/.cache/dfinity && rm $(which dfx) && sh -ci "$(curl -sSL https://sdk.dfinity.org/install.sh)"
Xcode precondition
stay macOS When creating a new project on your computer , Some version of DFINITY Canister SDK You will be prompted to install Xcode. The prompt has been deleted , The dfx new The command does not require you to install any macOS Developer Tools . however , If you want to create Git The repository , You should install Developer Command Line Tools.
You can check whether the developer tools are installed by running xcode-select -p. You can install developer tools by running xcode-select --install.
Use VM Build failed on
If you dfx stay Ubuntu or CentOS Running with a virtual machine image on , When you try to run dfx build On command , You may see the error message shown below :
Building hello...
An error occurred:
Io(
Os {
code: 2,
kind: NotFound,
message: "No such file or directory",
},
)
Address usage error or orphaned process
If you are developing a project locally , You usually have a local version of the core Internet Computer processes —— Collectively referred to as —— stay replica Separate terminal or background operation . If you are running Internet The computer process did not terminate correctly , You may see operating system errors , Indicates that the address is already in use , Or you cannot use this dfx stop Command to stop the process normally .
In many cases you may encounter this problem . for example , If you dfx start Run in the local project directory , Then stop without first Internet Change to a different local project directory in case of a computer process , You may see this problem .
If you encounter a problem with a message that suspects that the address is already in use or that the process is running in the background , Please perform the following steps :
If you use the default local network binding , Please run the following command to see which process is listening 8000 port :
lsof -i tcp:8000Run the following command to terminate any orphaned processes :
killall dfx replicaClose the current terminal and open a new terminal window .
In the new terminal , Run the following command , Run the local Internet computer in a clean state :
dfx start --clean --background
Memory leak
Fixing memory leaks is an ongoing process . If you encounter any error messages related to memory leaks , You should do the following :
- function
dfx stopTo stop the currently running process . - uninstall
dfxTo prevent further degradation . - reinstall
dfx - function
dfx startTo restart the replica process .
perhaps , You can delete this .cache/dfinity Directory and reinstall the latest dfx Binary . for example :
rm -rf ~/.cache/dfinity && sh -ci "$(curl -sSL https://sdk.dfinity.org/install.sh)"
- https://sdk.dfinity.org/docs/developers-guide/cli-reference/dfx-wallet.html)
边栏推荐
- Go 接口实现原理【高阶篇】: type _interface struct
- 26 | superscalar and VLIW: how to make the CPU throughput exceed 1
- Redis' underlying data structure -- SDS
- Advanced MySQL: how to learn MySQL source code
- Give code vitality -- the way to read code neatly
- Install cuda+cusp environment and create the first helloword starter project
- MySQL Gtid_ Executed and gtid_ Purged modification time
- 2022 electrician (elementary) examination questions and simulation examination
- IDS persistence ---rdb
- [pytorch] pytorch0.4.0 installation tutorial and GPU configuration collection (including test code)
猜你喜欢

口碑好的食材配送信息化管理系统怎么样?

有什么好的管理软件来解决茶叶批发商面临的难题

MySQL table partitioning

Operation of simulated examination platform for examination question bank of G3 boiler water treatment operation certificate in 2022

Examination question bank and simulation examination for special operation certificate of safety management personnel of hazardous chemical business units in 2022

How app inventor accesses resource files in assets directory

Redis master-slave replication - the underlying principle of partial resynchronization

Detailed explanation of digital certificate and Ca

A troubleshooting process for database timeout caused by SQL misguided

18 | establish data path (middle): instruction + operation =cpu
随机推荐
【深度学习】:《PyTorch入门到项目实战》(十二)卷积神经网络:填充(padding)和步幅(stride)
Consistency under distributed
MySQL interview questions
[MySQL] rapid data deletion recovery tool - binlog2sql
[problem record] taberror: inconsistent use of tabs and spaces in indentation
[MySQL] the most complete MySQL monitoring project
获取类的属性
uniapp 小程序根据权限动态生成 tabbar
udf_ interval_ to_ Hourno() function
23 | 冒险和预测(二):流水线里的接力赛
Recognition of COVID-19 based on paddlepaddle
批发商为什么要使用订单系统
2021-10-08
[problem record] json decoder. JSONDecodeError:Extra data: line xxx column xxx(char xxxx)
MySQL: regexp_ replace
Classification of databases
【Emgu.CV】Emgu.CV.Example\OCR运行报错System.IO.FileNotFoundException:“未能加载文件或程序集“System.Drawing.Common
力扣(LeetCode)163. 缺失的区间(2022.06.12)
MySQL table partitioning
How app inventor accesses resource files in assets directory