问题描述
从此页面安装Hyperledger Composer cli后,我尝试调用composer命令,但出现此错误:
After installing Hyperledger Composer cli from this page, I tried to call composer command but got this error:
module.js:549
throw err;
^
Error: Cannot find module './api'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/user/.nvm/versions/node/v8.11.1/lib/node_modules/composer-cli/node_modules/node-report/index.js:3:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
我使用此命令来安装Hyperledger Composer:
I used this command to install Hyperledger Composer:
npm install --unsafe-perm -g composer-cli
我能知道怎么了吗?
推荐答案
在我的情况下,我在全局/usr/lib/node_modules/composer-cli
中安装了composer-cli,但遇到了相同的问题.我不知道怎么了,但是我尝试了:
In my case I installed composer-cli in global /usr/lib/node_modules/composer-cli
and I met the same problem. I don't know what's wrong but I tried:
-
将目录更改为composer-cli:
Change directory into the composer-cli:
cd/usr/lib/node_modules/composer-cli
重新安装节点报告模块,本地在composer-cli内:
Reinstall node report module, locally inside the composer-cli:
sudo npm install node-report --unsafe-perm
注意,我没有将 -g
参数放在 sudo npm install
中,以使安装对于composer-cli本身是本地的.
Notice I don't put -g
param in sudo npm install
to make the installation local to the composer-cli itself.
node-report
将与 g ++
一起运行 make
进行编译(由于某种原因未在composer-cli安装期间运行)它就可以了...现在我可以运行作曲家了.
The node-report
will run make
with g++
to compile something (which for some reason was not run during composer-cli installation) and it just works... Now I can run composer.
根据您的情况,将工作目录设置为/home/user/.nvm/versions/node/v8.11.1/lib/node_modules/composer-cli
.
For your case set the working directory to /home/user/.nvm/versions/node/v8.11.1/lib/node_modules/composer-cli
instead.
这篇关于错误:找不到模块&#39; ./api'.(Hyperledger作曲家)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!