并非所有的先决条件都可以为Hyperledger Composer正确安装 [英] Not all pre-reqs install correctly for Hyperledger Composer
问题描述
我一直在关注Hyperledger Composer教程.我设法在Windows 10 Enterprise的Hyper-V上安装Ubuntu 16.04.然后,我开始按照以下先决条件安装说明进行操作: https://hyperledger.github.io/composer/installing/installing-prereqs. html
I've been following the Hyperledger Composer tutorial. I managed to install Ubuntu 16.04 on Hyper-V on my Windows 10 Enterprise. I then started on the following pre-req installation instructions: https://hyperledger.github.io/composer/installing/installing-prereqs.html
我运行了prereqs-ubuntu.sh脚本.运行正常,没有错误.我检查了日志,发现它已成功安装了npm 5.6.0,节点8.9.4,docker 17.12.x,docker composer 1.13.x和Python 2.7.12.
I ran the prereqs-ubuntu.sh script. It ran fine with no errors. I examined the logs and saw that it had successfully installed npm 5.6.0, node 8.9.4, docker 17.12.x, docker composer 1.13.x, and Python 2.7.12.
但是,当我运行时,运行$ sudo npm --version 它告诉我找不到npm命令
However, when I run run $ sudo npm --version it tells me that the npm command is not found
与$ sudo node --version相同 找不到...?!
Same with $ sudo node --version Not found...?!
为什么在日志中清楚显示npm和成功安装节点的情况下?!
Why would that be when the log clearly shows that npm and node where successfuly installed?!
推荐答案
好吧,我做了什么并通过以下方式进行了管理:
Well, what I did and managed through:
->安装nodejs和npm:
--> install nodejs and npm:
sudo snap install node --classic --channel=8
这样您可以获得最新的node8.
so you get the latest node8.
->然后要解决节点的"sudo"问题,请指定npm前缀:
--> then to solve "sudo" problem with node specify the npm prefix:
npm config set prefix ~/.node_modules
将以下内容添加到.bash_profile
add the following to .bash_profile
export PATH=$HOME/.node_modules/bin:$PATH
现在,这些软件包将安装到您的用户目录中,并且不会损害任何权限.
Now the packages will install into your user directory and no permissions will be harmend.
->安装nvm(在下一步中准确获取节点8.9版本):
--> install nvm (to get exactly node 8.9 version on the next step):
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
或
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
验证:
node -v nvm
如果安装成功,应该输出"nvm".
which should output 'nvm' if the installation was successful.
->获取并设置节点8.9版本:
--> get and set node 8.9 version:
nvm install v8.9.0
nvm use 8.9.0
->重置PATH:
echo export PATH="$HOME/npm/bin:$PATH" >> ~/.bashrc
npm config set prefix ~/npm
echo "export NODE_PATH=$NODE_PATH:/home/$USER/npm/lib/node_modules" >> ~/.bashrc && source ~/.bashrc
->在此阶段,docker先前的设置应被销毁:
--> at this stage the docker previous setup shall be destroyed:
docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q)
->安装其余的先决条件:
--> Installing the rest of prereqs:
sudo apt-add-repository -y ppa:git-core/ppa
sudo apt-get update
# install git
sudo apt-get install -y git
# Ensure that CA certificates are installed
sudo apt-get -y install apt-transport-https ca-certificates
# Add Docker repository key to APT keychain
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Update package lists
sudo apt-get update
# Verifies APT is pulling from the correct Repository
sudo apt-cache policy docker-ce
# Install Docker
echo "# Installing Docker"
sudo apt-get -y install docker-ce
# Add user account to the docker group
sudo usermod -aG docker $(whoami)
# Install docker compose
echo "# Installing Docker-Compose"
sudo curl -L "https://github.com/docker/compose/releases/download/1.13.0/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Install unzip, required to install hyperledger fabric.
sudo apt-get -y install unzip
->现在您可以安装Fabric开发器.环境(假设其余的prereq组件均可用):
--> now you can install Fabric dev. env. (assuming the rest of prereq components stand available):
npm install -g composer-cli
等
这篇关于并非所有的先决条件都可以为Hyperledger Composer正确安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!