烧录失败,权限不足
烧录时错误提示如下
- > Executing task in folder myfristproject: hpm run 'build' <
- hpm : 无法加载文件 D:nodejsnpmhpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 abou
- t_Execution_Policies。
- 所在位置 行:1 字符: 1
- + hpm run 'build'
- + ~~~
- + CategoryInfo : SecurityError: (:) [],PSSecurityException
- + FullyQualifiedErrorId : UnauthorizedAccess
- The terminal process "C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -Command hpm run 'build'" terminated with exit code: 1.
复制代码
网上找到类似问题并找到解决方式:华为鸿蒙OS 尝鲜 (三)DevEco Device Tool 待完善
- VSCode以管理员模式启动
- 切换到命令行执行如下命令:(set-ExecutionPolicy RemoteSigned)
- Windows PowerShell
- 版权所有 (C) Microsoft Corporation。保留所有权利。
- 尝试新的跨平台 PowerShell https://aka.ms/pscore6
- PS C:Usersdavin.jiang> set-ExecutionPolicy RemoteSigned
复制代码再次烧录,此问题解决。
安装serialport失败
烧录时提示Load serialport,@serialport/parser-readline failed.选择“y”后将自动安装相应插件。
安装报如下错误
- > Executing task: npm install -g serialport;npm install -g @serialport/parser-readline <
- (node:1616) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
- > @serialport/bindings@9.0.2 install C:Usersdavin.jiangAppDataRoamingnpmnode_modulesserialportnode_modules@serialportbindings
- > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
- (node:10108) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests
- insecure by disabling certificate verification.
- prebuild-install WARN install No prebuilt binaries found (target=12.18.4 runtime=node arch=x64 libc= platform=win32)
- C:Usersdavin.jiangAppDataRoamingnpmnode_modulesserialportnode_modules@serialportbindings>if not defined npm_config_node_gyp (node "D:_software_installnodenode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin\....node_modulesnode-gypbinnode-gyp.js" rebuild ) else (node "D:_software_installnodenode_modulesnpmnode_modulesnode-gypbinnode-gyp.js" rebuild )
- gyp ERR! find Python
- gyp ERR! find Python Python is not set from command line or npm configuration
- gyp ERR! find Python Python is not set from environment variable PYTHON
- gyp ERR! find Python checking if "python" can be used
- gyp ERR! find Python - "python" is not in PATH or produced an error
- gyp ERR! find Python checking if "python2" can be used
- gyp ERR! find Python - "python2" is not in PATH or produced an error
- gyp ERR! find Python checking if "python3" can be used
- gyp ERR! find Python - "python3" is not in PATH or produced an error
- gyp ERR! find Python checking if the py launcher can be used to find Python 2
- gyp ERR! find Python - "py.exe" is not in PATH or produced an error
- gyp ERR! find Python checking if Python is C:Python27python.exe
- gyp ERR! find Python - "C:Python27python.exe" could not be run
- gyp ERR! find Python checking if Python is C:Python37python.exe
- gyp ERR! find Python - "C:Python37python.exe" could not be run
- gyp ERR! find Python
- gyp ERR! find Python **********************************************************
- gyp ERR! find Python You need to install the latest version of Python.
- gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
- gyp ERR! find Python you can try one of the following options:
- gyp ERR! find Python - Use the switch --python="C:PathTopython.exe"
- gyp ERR! find Python (accepted by both node-gyp and npm)
- gyp ERR! find Python - Set the environment variable PYTHON
- gyp ERR! find Python - Set the npm configuration variable python:
- gyp ERR! find Python npm config set python "C:PathTopython.exe"
- gyp ERR! find Python For more information consult the documentation at:
- gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
- gyp ERR! find Python **********************************************************
- gyp ERR! find Python
- gyp ERR! configure error
- gyp ERR! stack Error: Could not find any Python installation to use
- gyp ERR! stack at PythonFinder.fail (D:_software_installnodenode_modulesnpmnode_modulesnode-gyplibfind-python.js:307:47)gyp ERR! stack at PythonFinder.runChecks (D:_software_installnodenode_modulesnpmnode_modulesnode-gyplibfind-python.js:136:21)
- gyp ERR! stack at PythonFinder.<anonymous> (D:_software_installnodenode_modulesnpmnode_modulesnode-gyplibfind-python.js:225:16)
- gyp ERR! stack at PythonFinder.execFileCallback (D:_software_installnodenode_modulesnpmnode_modulesnode-gyplibfind-python.js:271:16)
- gyp ERR! stack at exithandler (child_process.js:310:5)
- gyp ERR! stack at ChildProcess.errorhandler (child_process.js:322:5)
- gyp ERR! stack at ChildProcess.emit (events.js:315:20)
- gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
- gyp ERR! stack at onErrorNT (internal/child_process.js:469:16)
- gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:84:21)
- gyp ERR! System Windows_NT 10.0.18363
- gyp ERR! command "D:\_software_install\node\node.exe" "D:\_software_install\node\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
- gyp ERR! cwd C:Usersdavin.jiangAppDataRoamingnpmnode_modulesserialportnode_modules@serialportbindings
- gyp ERR! node -v v12.18.4
- gyp ERR! node-gyp -v v5.1.0
- gyp ERR! not ok
- npm ERR! code ELIFECYCLE
- npm ERR! errno 1
- npm ERR! @serialport/bindings@9.0.2 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
- npm ERR! Exit status 1
- npm ERR!
- npm ERR! Failed at the @serialport/bindings@9.0.2 install script.
- npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
- npm ERR! A complete log of this run can be found in:
- npm ERR! C:Usersdavin.jiangAppDataRoamingnpm-cache_logs2020-10-18T08_01_49_699Z-debug.log
- (node:13644) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests
- insecure by disabling certificate verification.
- + @serialport/parser-readline@9.0.1
- updated 1 package in 2.476s
- Terminal will be reused by tasks, press any key to close it.
复制代码提示Python环境异常,检查发现系统未安装Python。
根据官方文档,python是在安装nodejs时勾选对话框中的选项框,自动安装必要工具(如Python、Visual Studio构建工具链)后自动安装的;但是我的PC的node环境是很早时候建好的,所以忽略了此步骤导致python环境缺失。
根据文档重新下载nodejs并安装即可。
反复提示加载serialport失败
烧录时提示加载失败(Load serialport,@serialport/parser-readline failed.
),选择全局安装插件成功后仍提示此错误,反复尝试多次仍无法解决
- > Executing task: hpm run 'upload' <
- Start flash images...
- Load serialport,@serialport/parser-readline failed.
- Please make sure system variable 'NODE_PATH' has been configured.
- You can run "npm config get prefix" to get prefix path, Set NODE_PATH to prefixnode_modules
- Do you want to install modules: serialport,@serialport/parser-readline now? y/n (default:y):
复制代码看后面的说明才知道NODE_PATH设置问题,查看了win10系统环境变量发现已设置的变量和当前变量不一致。通过命令行查看node全局安装地址
- > npm config get prefix
- C:Usersdavin.jiangAppDataRoamingnpmnode_modules
复制代码而查看win10 NODE_PATH环境变量值为(控制面板->系统和安全->系统->高级系统设置->环境变量->系统变量)
- D:_software_installnodenode_modules
复制代码两者不一致导致明明已经全局安装成功了,其他应用却无法加载到该插件。统一更新为NODE_PATH地址即可
- > npm config set prefix D:_software_installnode
- > npm config get prefix
- D:_software_installnode
复制代码再重新烧录,未再出现此问题。
MobaXterm工具串口无法使用
目前使用MobaXterm工具串口连接成功后无法下任何命令,改用IPOP工具连接串口并勾选“Newline”后可正常输入命令了,成功完成第一个demo,log如下
- ready to OS start
- sdk ver:Hi3861V100R001C00SPC025 2020-09-03 18:10:00
- FileSystem mount ok.
- wifi init success!
-
- 00 00:00:00 0 132 D 0/HIVIEW: hilog init success.
- 00 00:00:00 0 132 D 0/HIVIEW: log limit init success.
- 00 00:00:00 0 132 I 1/SAMGR: Bootstrap core services(count:3).
- 00 00:00:00 0 132 I 1/SAMGR: Init service:0x4ae4fc TaskPool:0xfa1e4
- 00 00:00:00 0 132 I 1/SAMGR: Init service:0x4ae520 TaskPool:0xfa854
- 00 00:00:00 0 132 I 1/SAMGR: Init service:0x4ae630 TaskPool:0xfaa14
- 00 00:00:00 0 164 I 1/SAMGR: Init service 0x4ae520 <time: 0ms> success!
- 00 00:00:00 0 64 I 1/SAMGR: Init service 0x4ae4fc <time: 0ms> success!
- 00 00:00:00 0 8 D 0/HIVIEW: hiview init success.
- 00 00:00:00 0 8 I 1/SAMGR: Init service 0x4ae630 <time: 0ms> success!
- 00 00:00:00 0 8 I 1/SAMGR: Initialized all core system services!
- 00 00:00:00 0 64 I 1/SAMGR: Bootstrap system and application services(count:0).
- 00 00:00:00 0 64 I 1/SAMGR: Initialized all system and application services!
- 00 00:00:00 0 64 I 1/SAMGR: Bootstrap dynamic registered services(count:0).
复制代码根据文档完成网络配置,并成功ping通百度地址
- AT+STARTSTA
- OK
-
- AT+SCAN
- AT+SCAN
- OK
-
- +NOTICE:SCANFINISH
- AT+SCANRESULT
- +SCANRESULT:dx_guest,20:54:fa:67:c5:09,1,-32,2
复制代码