1 DevEco Studio 突然多出好.js和.map的 文件

image.png
解決:手動刪除多出的.js和.map文件
補充:https://blog.csdn.net/qq_40533422/article/details/134881184(這個是下插件)
2 緊接上個操作,重新寫頁面使用預(yù)覽器無法顯示報錯
hvigor ERROR: Failed :entry:default@PreviewArkTS...
hvigor ERROR: default@PreviewArkTS watch work[0] failed.
hvigor ERROR: BUILD FAILED in 3 s 907 ms
解決:刪除entry->preview文件夾,重新啟動DevEco Studio 就可以了
2 開發(fā)過程中安裝dayjs步驟
先安裝ohpm
1 終端輸入open ~/.bash_profile打開.bash_profile 配置文件,輸入
export OHPM_HOME=/Users/ofweek/Documents/command-line-tools/ohpm(自己下載包的路徑)
export PATH=${OHPM_HOME}/bin:${PATH}
注意:自己的ohpm路徑可以通過DevEco-Studio查找(如下圖)

image.png
2 再輸入以下命令使環(huán)境變量立即生效
source ~/.bash_profile
重啟 DevEco-Studio,然后

image.png
輸入ohpm install dayjs

image.png
安裝成功
可以在文件夾 oh_modules下看到安裝的dayjs
也可以在oh-package.json5 文件看到dayjs信息

image.png