【HarmonyOS HiSpark IPC试用】用hpm获取源码方式环境--hpm安装,
昨天编译出错,可能gitee下载源码有问题,今天试试用hpm获取源码 安装Node.js。
打开CMD,执行以下命令: 安装完成后执行如下命令,显示hpm版本,即安装成功。 如果升级hpm的版本,请执行如下命令:
查看node版本 v10.19.0 fan@FAN:~$ npm install -g n npm ERR! code EACCES npm ERR! path /usr/local/lib npm ERR! Error: EACCES: permission denied, access \“/usr/local/lib\“ npm ERR! stack: npm ERR! errno: -13, npm ERR! syscall: \“access\“, npm ERR! npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! the command again as root/Administrator. npm ERR! A complete log of this run can be found in: 看来权限不够,加sudo [sudo] password for fan://输入密码 + n@7.0.1 安装最近稳定版本,是v14.15.4,应该够本了吧 installing : node-v14.15.4 mkdir: cannot create directory ‘/usr/local/n’: Permission denied Error: sudo required (or change ownership, or define N_PREFIX) fan@FAN:~$ sudo n stable mkdir : /usr/local/n/versions/node/14.15.4 instalLED : v14.15.4 (with npm 6.14.10) Note: the node command changed location and the old location may be remembered in your current shell. new : /usr/local/bin/node //新安装node目录 再查看node版本 v10.19.0 fan@FAN:~$ which node 已经指向新目录,我就不管它了 internal/modules/cjs/loader.js:883 ^ Error: Cannot find module \“semver\“ //报错没有semver - /usr/share/npm/lib/utils/unsupported.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Module.require (internal/modules/cjs/loader.js:952:19) at Object.<anonymous> (/usr/share/npm/lib/utils/unsupported.js:2:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Function.Module._load (internal/modules/cjs/loader.js:769:14) code: \“MODULE_NOT_FOUND\“, \“/usr/share/npm/lib/utils/unsupported.js\“, 报错没有semver 就安装 [sudo] password for fan: npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN fan No description npm WARN fan No README data
added 3 packages from 2 contributors in 8.69s
│ │ │ Changelog: https://github.com/npm/cli/releases/tag/v6.14.11 │ │ │ 提示升级npm npm ERR! code EACCES npm ERR! path /usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/yargs-parser npm ERR! errno -13 npm ERR! [OperationalError: EACCES: permission denied, rename \“/usr/local/lib/node_modules/.staging/npm-3e479054/node_modules/yargs-parser\“ -> \“/usr/local/lib/node_modules/.staging/yargs-parser-2ae220e0\“] { npm ERR! errno: -13, npm ERR! syscall: \“rename\“, npm ERR! dest: \“/usr/local/lib/node_modules/.staging/yargs-parser-2ae220e0\“ npm ERR! errno: -13, npm ERR! syscall: \“rename\“, npm ERR! dest: \“/usr/local/lib/node_modules/.staging/yargs-parser-2ae220e0\“ npm ERR! npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! the command again as root/Administrator. npm ERR! A complete log of this run can be found in: 升级也出错,尝试再安装semver npm WARN saveError ENOENT: no such file or directory, open \“/home/fan/package.json\“ npm WARN fan No description npm WARN fan No README data
updated 1 package in 0.924s fan@FAN:~$ sudo npm install -g @ohos/hpm-cli npm WARN deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410 npm ERR! Unexpected end of JSON input while parsing near \“...sj1FJcyP6mhwDIXJUbk3P\“ npm ERR! A complete log of this run can be found in: 再次安装hpm,提示……Unexpected end of JSON input……,清理缓存 npm WARN using --force I sure hope you know what you are doing. fan@FAN:~$ sudo npm install -g @ohos/hpm-cli npm WARN deprecated @babel/polyfill@7.12.1: