rddill-IBM / ZeroToBlockchain

Tutorial for Zero to Blockchain series
342 stars 924 forks source link

nodejs-legacy is required #14

Closed rmandrad closed 6 years ago

rmandrad commented 6 years ago

couldn't install the composer-cli - noticed your script hasn't installed nodejs-legacy - once I've installed it composer-cli got installed

rddill-IBM commented 6 years ago

Two questions:

(1) What OS are you using? I've tested these scripts successfully on Ubuntu 16 LTS and did not require nodejs-legacy.

(2) What version of the tutorial are you using?

The setup_Ubuntu_Part_1.sh file should have the following lines of code in lines 112-139

function nodeV8Install()
{
        showStep "${RED}node not installed. installing Node V8"
    # Install nvm dependencies
    showStep "Installing nvm dependencies"
    sudo apt-get -y install build-essential libssl-dev

    # Execute nvm installation script
    showStep "Executing nvm installation script"
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

    showStep "Set up nvm environment without restarting the shell"
    export NVM_DIR="${HOME}/.nvm"
    [ -s "${NVM_DIR}/nvm.sh" ] && . "${NVM_DIR}/nvm.sh"
    [ -s "${NVM_DIR}/bash_completion" ] && . "${NVM_DIR}/bash_completion"

    showStep "Installing nodeJS"
    nvm install --lts

    showStep "Configure nvm to use version 8"
    nvm use --lts
    nvm alias default 'lts/*'

    # Install the latest version of npm
    showStep "Installing npm"
    npm install npm@latest -g

}

and the installNodeDev function, starting at line 159 should show @0.16.0 for the cli version.

function installNodeDev ()
    {
        if [[ $SDK_INSTALL == "true" ]]; then
            showStep "The composer-cli contains all the command line operations for developing business networks."
            npm uninstall -g composer-cli
            npm install -g --python=python2.7 composer-cli@0.16.0
            showStep "The generator-hyperledger-composer is a Yeoman plugin that creates bespoke applications for your business network."
            npm uninstall -g generator-hyperledger-composer
            npm install -g --python=python2.7 generator-hyperledger-composer@0.16.0
            showStep "The composer-rest-server uses the Hyperledger Composer LoopBack Connector to connect to a business network, extract the models and then present a page containing the REST APIs that have been generated for the model."
            npm uninstall -g composer-rest-server
            npm install -g --python=python2.7 composer-rest-server@0.16.0
            showStep "Yeoman is a tool for generating applications. When combined with the generator-hyperledger-composer component, it can interpret business networks and generate applications based on them."
            npm install -g --python=python2.7 yo
        else   
            showStep "${RED}skipping NODE SDK for HyperLedger install"
        fi
    }
rmandrad commented 6 years ago

Hi, so

  1. I installed from scratch ubuntu-16.04.3-server-amd64
  2. clone this github repository
  3. the step InstallNodeDev - failed at the point when npm attempts to compile the packages. On the process NPM calls Node ... without a link it fails .. nodejs ins ... perhaps you can create a link "ln -s which nodejs /usr/local/bin/node" as part of the script
  4. once I installed the nodejs legacy - I was able to complete the install and start fabric/etc
rddill-IBM commented 6 years ago

This may be a result of you using the server version of ubuntu 16.04. The testing that I've done has been against the desktop version, specifically using ubuntu-16.04.3-desktop-amd64.iso as my foundation. Have installed native, VirtualBox and VMWare; none of those required the nodejs Legacy installation. Thanks for the info; I'll check later in the week against the server version and see if there's a way to catch this as part of the standard install process.

rddill-IBM commented 6 years ago

install scripts have been updated