我尝试像 Oracle 在 linux ubuntu 上所说的那样安装 ojet-cli globlay,但找不到 ojet 命令

i tried to install ojet-cli globlay like Oracle said on linux ubuntu but ojet command not found

我已经 Ubuntu OS 18.04 LTS, npm: '6.4.1', 战神:'1.14.0', cldr: '32.0.1', http_parser: '2.7.1', icu: '60.2', 模块:'57', nghttp2: '1.30.0', 节点:'8.10.0', openssl: '1.1.0g', tz: '2017c', 统一码:'10.0', 紫外线:'1.18.0', v8: '6.2.414.50', zlib: '1.2.11' .

当 ojet-cli 安装过程顺利完成时没有任何抱怨,但是当我尝试此命令时也找不到 ojet 命令

npm list -g ojet-cli

输出

~$ npm list -g @oracle/ojet-cli /home/tsam/.npm-global/lib

└── ojet-cli@3.2.0

也试过多次安装ojet-cli包也试过安装npm 通过这个命令 "useless"

sudo npm install npm

什么都没发生

另一件事:我尝试运行这个命令

npm run ojet

输出:

0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'ojet' ] 2 info using npm@6.4.1 3 info using node@v8.10.0 4 verbose config Skipping project config: /home/tsam/.npmrc. (matches userconfig) 5 verbose stack Error: ENOENT: no such file or directory, open '/home/tsam/package.json' 6 verbose cwd /home/tsam 7 verbose Linux 4.15.0-36-generic 8 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "ojet" 9 verbose node v8.10.0 10 verbose npm v6.4.1 11 error path /home/tsam/package.json 12 error code ENOENT 13 error errno -2 14 error syscall open 15 error enoent ENOENT: no such file or directory, open '/home/tsam/package.json' 16 error enoent This is related to npm not being able to find a file. 17 verbose exit [ -2, true ]

问题:

ojet command not found

原因: npm install packages 的位置与执行的命令路径不匹配, 当

检查 npm 配置时

npm config get

找到了

prefix = "/home/tsam/.npm-global"

解法:

像这样将环境路径更改为此路径 + /bin

export PATH=$PATH:~/.npm-global/bin

要使此配置永久生效,您必须将其更改为

~/.profile 文件并保存。