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)
I used this command to install Hyperledger Composer:
npm install --unsafe-perm -g composer-cli
May I know what is going wrong?
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:
Change directory into the composer-cli:
cd /usr/lib/node_modules/composer-cli
Reinstall node report module, locally inside the composer-cli:
sudo npm install node-report --unsafe-perm
Notice I don't put -g
param in sudo npm install
to make the installation local to the composer-cli itself.
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.
For your case set the working directory to /home/user/.nvm/versions/node/v8.11.1/lib/node_modules/composer-cli
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With