HarmonyOS 鸿蒙Next compileSdkVersion为api8时无法安装OpenHarmony三方库中心仓

HarmonyOS 鸿蒙Next compileSdkVersion为api8时无法安装OpenHarmony三方库中心仓 问题如题:

nodejs和npm版本:

~/tools/huawei/nodejs/bin/npm --version  
8.19.3
~/tools/huawei/nodejs/bin/node --version
v16.19.1

npm confg

{
  "json": true,
  "registry": "https://repo.huaweicloud.com/repository/npm/",
  "[@ohos](/user/ohos):registry": "https://repo.harmonyos.com/npm/",
  "access": null,
  "all": false,
  "allow-same-version": false,
  "also": null,
  "audit": true,
  "audit-level": null,
  "auth-type": "legacy",
  "before": null,
  "bin-links": true,
  "browser": null,
  "ca": null,
  "cache": "/Users/xxx/.npm",
  "cache-max": null,
  "cache-min": 0,
  "cafile": null,
  "call": "",
  "cert": null,
  "ci-name": null,
  "cidr": null,
  "color": true,
  "commit-hooks": true,
  "depth": null,
  "description": true,
  "dev": false,
  "diff": [],
  "diff-ignore-all-space": false,
  "diff-name-only": false,
  "diff-no-prefix": false,
  "diff-dst-prefix": "b/",
  "diff-src-prefix": "a/",
  "diff-text": false,
  "diff-unified": 3,
  "dry-run": false,
  "editor": "vi",
  "engine-strict": false,
  "fetch-retries": 2,
  "fetch-retry-factor": 10,
  "fetch-retry-maxtimeout": 60000,
  "fetch-retry-mintimeout": 10000,
  "fetch-timeout": 300000,
  "force": false,
  "foreground-scripts": false,
  "format-package-lock": true,
  "fund": true,
  "git": "git",
  "git-tag-version": true,
  "global": false,
  "global-style": false,
  "globalconfig": "/usr/local/etc/npmrc",
  "heading": "npm",
  "https-proxy": null,
  "if-present": false,
  "ignore-scripts": false,
  "include": [],
  "include-staged": false,
  "include-workspace-root": false,
  "init-author-email": "",
  "init-author-name": "",
  "init-author-url": "",
  "init-license": "ISC",
  "init-module": "/Users/xxx/.npm-init.js",
  "init-version": "1.0.0",
  "init.author.email": "",
  "init.author.name": "",
  "init.author.url": "",
  "init.license": "ISC",
  "init.module": "/Users/xxx/.npm-init.js",
  "init.version": "1.0.0",
  "install-links": false,
  "key": null,
  "legacy-bundling": false,
  "legacy-peer-deps": false,
  "link": false,
  "local-address": null,
  "location": "user",
  "lockfile-version": null,
  "loglevel": "notice",
  "logs-dir": null,
  "logs-max": 10,
  "long": false,
  "maxsockets": 15,
  "message": "%s",
  "node-options": null,
  "node-version": "v19.5.0",
  "noproxy": [
    ""
  ],
  "npm-version": "8.19.3",
  "offline": false,
  "omit": [],
  "omit-lockfile-registry-resolved": false,
  "only": null,
  "optional": null,
  "otp": null,
  "package": [],
  "package-lock": true,
  "package-lock-only": false,
  "pack-destination": ".",
  "parseable": false,
  "prefer-offline": false,
  "prefer-online": false,
  "prefix": "/usr/local",
  "preid": "",
  "production": null,
  "progress": true,
  "proxy": null,
  "read-only": false,
  "rebuild-bundle": true,
  "replace-registry-host": "npmjs",
  "save": true,
  "save-bundle": false,
  "save-dev": false,
  "save-exact": false,
  "save-optional": false,
  "save-peer": false,
  "save-prefix": "^",
  "save-prod": false,
  "scope": "",
  "script-shell": null,
  "searchexclude": "",
  "searchlimit": 20,
  "searchopts": "",
  "searchstaleness": 900,
  "shell": "/bin/zsh",
  "shrinkwrap": true,
  "sign-git-commit": false,
  "sign-git-tag": false,
  "sso-poll-frequency": 500,
  "sso-type": "oauth",
  "strict-peer-deps": false,
  "strict-ssl": true,
  "tag": "latest",
  "tag-version-prefix": "v",
  "timing": false,
  "tmp": "/var/folders/_z/pyrpdf8x5fq2d_15wcztbdww0000gn/T",
  "umask": 0,
  "unicode": true,
  "update-notifier": true,
  "usage": false,
  "user-agent": "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}",
  "userconfig": "/Users/xxx/.npmrc",
  "version": false,
  "versions": false,
  "viewer": "man",
  "which": null,
  "workspace": [],
  "workspaces": null,
  "workspaces-update": true,
  "yes": null,
  "metrics-registry": "https://repo.huaweicloud.com/repository/npm/"
}

其中已经设置[@ohos](/user/ohos):registry": "https://repo.harmonyos.com/npm/

安装组件的时候:

~/tools/huawei/nodejs/bin/npm install [@ohos](/user/ohos)/dataorm@2.1.1 --save

npm ERR! code E404
npm ERR! 404 Not Found - GET https://repo.harmonyos.com/npm/@ohos%2fdataorm
npm ERR! 404
npm ERR! 404 ‘@ohos/dataorm@2.1.1’ is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

组件地址:https://ohpm.openharmony.cn/#/cn/detail/@ohos%2Fdataorm/v/2.1.1


更多关于HarmonyOS 鸿蒙Next compileSdkVersion为api8时无法安装OpenHarmony三方库中心仓的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

全世界都在开发鸿蒙应用了,ide下载下来建个hollo hormony工程都是404.。。 能不能发挥长处。。

更多关于HarmonyOS 鸿蒙Next compileSdkVersion为api8时无法安装OpenHarmony三方库中心仓的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


兄弟,你这是在用dataorm吗,官方文档里面

let helper: ExampleOpeHelper = new ExampleOpenHelper(this.context, "notes.db");
helper.setEntities(Note);
let db: Database = await helper.getWritableDb();
this.data.daoSession = new DaoMaster(db).newSession();

ExampleOpeHelper是什么玩意,怎么来的都没写,能告诉我吗

ohpm配置这个地址试一下:https://repo.harmonyos.com/ohpm/

在HarmonyOS鸿蒙Next中,当compileSdkVersion设置为api8时,无法安装OpenHarmony三方库中心仓的原因可能与API版本兼容性有关。OpenHarmony的三方库中心仓可能尚未完全适配api8,导致在编译或安装时出现兼容性问题。通常,三方库需要针对特定的API版本进行适配和测试,以确保在不同版本的SDK上能够正常运行。如果三方库未对api8进行适配,可能会出现无法安装或运行异常的情况。建议检查三方库的文档或更新日志,确认其支持的API版本范围,并确保与compileSdkVersion匹配。

回到顶部