积分401 / 贡献0

提问30答案被采纳5文章46

作者动态

Flutter 环境监测是ok的,创建项目也ok,编译报错,如何处理

润开鸿_坚果 显示全部楼层 发表于 2024-7-13 18:41:36

Flutter 环境监测是ok的,创建项目也ok,编译报错,如何处理

jianguo@jianguodeMacBook-Pro-2 harmonyflutter % flutter doctor -v 
[✓] Flutter (Channel stable, 3.13.0, on macOS 13.4.1 22F82 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.13.0 on channel stable at /Users/jianguo/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d9c6 (11 个月前), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/jianguo/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/jianguo/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.90.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.92.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.4.1 22F82 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 126.0.6478.127

[✓] Network resources
    • All expected network resources are available.

• No issues found!

image-20240713183726310

但是我在编译的时候,会报错,请问大家遇到过吗?

image-20240713183844490

image-20240713183952641

jianguo@jianguodeMacBook-Pro-2 harmonyflutter % flutter build hap
start hap build...
Compiling ohos_aot_bundle_release_ohos-arm64 for the Ohos...      1,449ms
copy flutter assets to project start
copy directory from /Users/jianguo/Desktop/teaching/harmonyflutter/build/ohos/flutter_assets to
/Users/jianguo/Desktop/teaching/harmonyflutter/ohos/entry/src/main/resources/rawfile/flutter_assets
copy flutter assets to project end
copy flutter runtime to project start
copy from: /Users/jianguo/huawei/flutter_flutter/bin/cache/artifacts/engine/ohos-arm64-release/flutter.har to
/Users/jianguo/Desktop/teaching/harmonyflutter/ohos/har/flutter.har
copy flutter runtime to project end
ohpm WARN: local dependency "@ohos/flutter_ohos" found in
"/Users/jianguo/Desktop/teaching/harmonyflutter/ohos/oh-package.json5" does not match the actual name "flutter" of its
oh-package.json5
ohpm INFO: remove useless folder succeed:
"/Users/jianguo/Desktop/teaching/harmonyflutter/ohos/oh_modules/.ohpm/@ohos+flutter_ohos@3a8wss7erigmz+t6nntx0yxm5oi=/oh_modul
es/@ohos/flutter_ohos.1720867177585.ohpm-delete"
install completed in 0s 260ms
ohpm install success.
ohpm WARN: local dependency "@ohos/flutter_ohos" found in
"/Users/jianguo/Desktop/teaching/harmonyflutter/ohos/oh-package.json5" does not match the actual name "flutter" of its
oh-package.json5
install completed in 0s 23ms
ohpm install success.

[2024-07-13 18:39:38]ERROR: NODE_HOME is set to an invalid directory,check /usr/local/bin/node

Please set NODE_HOME in your environment to the location where your nodejs installed
error! when invoke: hvigorw assembleHap --no-daemon ,exitCode = 1. 
assembleHap error! please check log.

完毕

您尚未登录,无法参与评论,登录后可以:
参与开源共建问题交流
认同或收藏高质量问答
获取积分成为开源共建先驱

精彩评论1

fengyunrenwu

沙发 发表于 2024-8-6 19:16:39
这个报错需要按照flutter的说明来配置node环境。如果以hvigor的角度,需要使用完整的command-line工具才能让hvigorw识别编译环境。所以推荐使用command-line工具,并按照流水线配置环境变量。

command-line工具下载链接:https://developer.huawei.com/consumer/cn/download/

流水线配置文档:https://developer.huawei.com/con ... ection1411782572213

Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

返回顶部