Why does Fabric Composer npm-install fail for my Ubuntu setup? - npm-install

I'm a newbie to npm and hyperledger fabric-composer
Question: What is the problem with my setup? What is the strategy to investigate and solve such errors?
What I did:
Setup Ubuntu Linux 14.04 LTS (64-bit)
Installing prerequisites using the script provided on
https://fabric-composer.github.io/tasks/prerequisites.html
Executing npm install causes (don't know if this info is sufficient):
[...]
File "/usr/local/lib/python2.7/dist-packages/docker/transport/ssladapter.py", line 22, in <module>
urllib3.connection.match_hostname = match_hostname
AttributeError: 'module' object has no attribute 'connection'
npm ERR! Linux 4.4.0-31-generic
npm ERR! argv "/home/mjh/.nvm/versions/node/v4.6.2/bin/node" "/home/mjh/.nvm/versions/node/v4.6.2/bin/npm" "install"
npm ERR! node v4.6.2
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! getting-started#1.0.0 install: `scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the getting-started#1.0.0 install script 'scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls getting-started
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/mjh/sample-applications/packages/getting-started/npm-debug.log
See link for detailed npm-debug.log file
https://gist.github.com/mjh-halder/9fe473b44f0a731c996bbc5754011013

I've seen this problem before on trusty (14.04) and relates to an out of date urllib3 library for python, which is used by docker compose.
depending on which version of pip you have installed you can update the urllib library as follows
pip install --upgrade pip
pip install -U urllib3

You are missing permissions, so you need to do sudo npm-install ...

The issue here is related to the last part of the installation script - this is the part that installs the docker-compose tool. Testing this today on a clean Ubuntu 14.04 LTS image, that was the cause.
I'd recommend installing docker-compose following the instructions on the docker site. (https://docs.docker.com/compose/install/)
In effect this is
curl -L "https://github.com/docker/compose/releases/download/1.10.0/docker-compose-$(uname -s)-$(uname -m)" -o
chmod +x /usr/local/bin/docker-compose
Run the docker-compose --version to check it's installed correctly
$ docker-compose --version
docker-compose version: 1.10.0
Then run the rest of the Fabric Composer scripts as before.
We're updating the script - but this should get you going.

Related

NPM completely broken and won't reinstall after failed upgrade

Mac Catalina 10.15.6
I already had npm installed. I wanted to upgrade so I ran the following.
npm install -g npm
Below is the output:
$name#$names-MacBook-Pro desktop % npm install -g npm
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm ERR! code EEXIST npm ERR! syscall symlink npm ERR! path
../../../lib/node_modules/npm/man/man1/npm-bin.1 npm ERR! dest
/usr/local/share/man/man1/npm-bin.1 npm ERR! errno -17 npm ERR!
EEXIST: file already exists, symlink
'../../../lib/node_modules/npm/man/man1/npm-bin.1' ->
'/usr/local/share/man/man1/npm-bin.1' npm ERR! File exists:
/usr/local/share/man/man1/npm-bin.1 npm ERR! Remove the existing file
and try again, or run npm npm ERR! with --force to overwrite files
recklessly.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/$name/.npm/_logs/2020-10-04T14_41_02_611Z-debug.log
Now all NPM commands fail.
zsh: command not found: npm
Everything from:
npm -v
sudo npm install npm -g
I just used home brew to upgrade NPM and it deleted and reinstalled all the necessary files.
This generally works for me on Mac:
brew upgrade
brew cleanup
brew install npm
(note you'll need the xcode tools if you don't have it - try xcode-select --install or check out this answer.)
Now, try npm install again and see if that changes anything.
Also, see this potentially related answer.

How can I install gulp-cli#4.0?

I have trouble with installing gulp-cli.
npm install -g "gulpjs/gulp-cli#4.0"
I am getting this error.
npm ERR! code 1
npm ERR! Command failed: C:\Program Files\Git\mingw64\bin\git.EXE checkout 4.0
npm ERR! error: pathspec '4.0' did not match any file(s) known to git.
npm ERR!
Sorry for this question but what I am doing wrong with this?
Guy the last version of gulp-cli is 2.0.1, to install a specific version just run npm i -g gulp-cli#VERION-THAT-YOU-NEED maybe you would like to install gulp that is on version 4.0.0-alpha.3 , for it just run: npm install gulpjs/gulp#v4.0.0-alpha.3

Unable to install Appium on Ubuntu 16.04

Is it because of network proxy settings in my machine? Also I am under corporate firewall.
error:Failed at the appium-chromedriver#2.9.2 install script 'node
install-npm.js'
Kindly help me to solve this issue
paranth#paranth-ThinkCentre-M73:~$ npm install -g appium
/home/paranth/.linuxbrew/bin/appium -> /home/paranth/.linuxbrew/lib/node_modules/appium/build/lib/main.js
/home/paranth/.linuxbrew/bin/authorize-ios -> /home/paranth/.linuxbrew/lib/node_modules/appium/node_modules/.bin/authorize-ios
> appium-chromedriver#2.9.2 install /home/paranth/.linuxbrew/lib/node_modules/appium/node_modules/appium-android-driver/node_modules/appium-chromedriver
> node install-npm.js
info Chromedriver Install Installing Chromedriver version '2.21' for platform 'linux' and architecture '64'
info Chromedriver Install Opening temp file to write chromedriver_linux64 to...
info Chromedriver Install Downloading http://chromedriver.storage.googleapis.com/2.21/chromedriver_linux64.zip...
info Chromedriver Install Writing binary content to /tmp/201694-10666-t0tuz0.b4lorsh5mi/chromedriver_linux64.zip...
info Chromedriver Install Extracting /tmp/201694-10666-t0tuz0.b4lorsh5mi/chromedriver_linux64.zip to /tmp/201694-10666-t0tuz0.b4lorsh5mi/chromedriver_linux64
Invalid or unsupported zip format. No END header found
/home/paranth/.linuxbrew/lib
`-- (empty)
npm WARN optional Skipping failed optional dependency /appium/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.14
npm ERR! Linux 4.4.0-38-generic
npm ERR! argv "/home/paranth/.linuxbrew/Cellar/node/6.7.0/bin/node" "/home/paranth/.linuxbrew/bin/npm" "install" "-g" "appium"
npm ERR! node v6.7.0
npm ERR! npm v3.10.7
npm ERR! code ELIFECYCLE
npm ERR! appium-chromedriver#2.9.2 install: `node install-npm.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appium-chromedriver#2.9.2 install script 'node install-npm.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the appium-chromedriver package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install-npm.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs appium-chromedriver
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls appium-chromedriver
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/paranth/npm-debug.log
npm ERR! code 1
To set up android automation in linux:
a) linuxbrew installation: https://github.com/Linuxbrew/linuxbrew
b) Download and extract android sdk to home folder: http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
c) Set android sdk path:
Open file by command:
sudo gedit ~/.bashrc
Add these lines at the end of the file:
adding linux brew path
export PATH="$HOME/.linuxbrew/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/.linuxbrew/lib:$LD_LIBRARY_PATH"
#android
export ANDROID_HOME=/home/asci/android-sdk-linux
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Close the file.
Run the command:
source ~/.bashrc
e) Run these commands one by one:
android
(It will open the sdk manager, and install all the sdk tools from the Tools folder and Android 6.0 API 23)
brew install node
npm install -g appium
appium &
(It will start the appium server needed to run automation)
Get out of firewall or business network and try from a personal data network. It'll work. It worked for me.
Then try "npm install -g appium"

npm install -g yo command gives -> ERR! yo#1.1.0 postinstall: `node scripts/doctor.js`

I just tried to do a npm install but get this error about doctor,js at the end. Do I need to worry about it?
npm install -g yo
.
.
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 200 https://registry.npmjs.org/fstream/-/fstream-0.1.25.tgz
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/cli.js
> yo#1.1.0 postinstall /usr/local/lib/node_modules/yo
> node scripts/doctor.js
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! yo#1.1.0 postinstall: `node scripts/doctor.js`
npm ERR! `sh "-c" "node scripts/doctor.js"` failed with 1
npm ERR!
npm ERR! Failed at the yo#1.1.0 postinstall script.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/doctor.js
npm ERR! You can get their info via:
npm ERR! npm owner ls yo
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /etc/libvirt/qemu
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /etc/libvirt/qemu/npm-debug.log
npm ERR! not ok code 0
EDIT____________--
for some reason node -v outputs nothing in terminal
I have the latest node installed:
WebstormProjects # sudo apt-get install node
Reading package lists... Done
Building dependency tree
Reading state information... Done
node is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 143 not upgraded.
The solution at this link has worked for me:
http://plaidzooks.tumblr.com/post/36894116867/using-node-js-on-debian-ubuntu-systems
Ubuntu comes with a package that automatically creates a link so the command 'nodejs' can be invoked as 'node' only by creating a link.
sudo apt-get install nodejs-legacy
And that got Yeoman working.
Likewise I had this same problem (albeit on a Mac). I uninstalled and upgraded node to the latest version (v0.10.24) but without success.
The symlink fix did work for me, although with a slight tweak:
sudo ln -s /usr/local/bin/node /usr/bin/node
I believe this may be due to the way which node was installed on your system. Apparently, sometimes when installing Node via a package manager, the linked binary is nodejs, (thus nodejs _command_ is the command that works on your machine, not the much more common node _comamand_. You can either re-install Node (the latest version is now 0.10.24) from nodejs.org, or try this solution from this related issue:
For anyone wishing to still use their OS's package of node the simple solution for this is to determine where node is installed on your OS and then create a symbolic link.
For example I had the issue on ubuntu and the install directory is /usr/bin. To create the symlink you can run:
sudo ln -s /usr/bin/nodejs /usr/bin/node
in windows you can use the mklink command.. Be sure to open the command prompt as a administrator
You have to install nodejs in this way:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
I had this same error on a clean Ubuntu 13.10 install and no amount of sym linking (node > nodejs) or installing/uninstalling helped me.
I don't have a deep enough understanding of the node environment to troubleshoot it properly but I was able to install Yeoman globally by cloning the repo and removing the postinstall check from package.json.
If anyone else want's to try this solution:
Clone Yeoman..
cd ~
git clone https://github.com/yeoman/yo
Edit the package.json..
nano yo/package.json
.. to remove these lines..
"scripts": {
"test": "grunt",
"postinstall": "node ./scripts/doctor",
"postupdate": "node ./scripts/doctor"
},
Then, install it using npm..
cd yo
npm install -g
If you want to clean up you can remove the Yeoman repo..
cd ..
rm -R yo/
Obviously your mileage may vary but it's working fine for me so far.
I also noticed I was able to successfully run the doctor.js script independent of the installation process. No idea why it was failing so hard in the first place..
On Ubuntu 14.04, I tried both installing the legacy package (per Antonio's answer) and creating the symlink manually (per Stephen's answer). Neither worked. The Ubuntu package has version 0.10.25 of node.js, but Yeoman seems to require a newer version.
After installing the latest version of node.js from NodeSource (currently v6.9.1), I was able to install Yeoman using npm install -g yo .
To solve this problem you need to install the package nodejs-legacy.
sudo apt-get install nodejs-legacy

NPM install express. Error: No compatible version found

My OS is Ubuntu 13.04, 32 bit.
I am trying to install express with this command:
$ npm install express
And this is the error I get:
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express
npm http 304 https://registry.npmjs.org/express
npm ERR! Error: No compatible version found: express#'>=4.0.0-0'
npm ERR! Valid install targets:
npm ERR! ["0.14.0","0.14.1","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.0.7","1.0.8","2.0.0","2.1.0","2.1.1","2.2.0","2.2.1","2.2.2","2.3.0","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.3.8","2.3.9","2.3.10","2.3.11","2.3.12","2.4.0","2.4.1","2.4.2","2.4.3","2.4.4","2.4.5","2.4.6","2.4.7","2.5.0","2.5.1","2.5.2","2.5.3","2.5.4","2.5.5","2.5.6","2.5.7","2.5.8","2.5.9","2.5.10","2.5.11","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6","3.1.0","3.1.1","3.1.2","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.2.6","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","1.0.0-beta","1.0.0-beta2","1.0.0-rc","1.0.0-rc2","1.0.0-rc3","1.0.0-rc4","2.0.0-beta","2.0.0-beta2","2.0.0-beta3","2.0.0-rc","2.0.0-rc2","2.0.0-rc3","3.0.0-alpha1","3.0.0-alpha2","3.0.0-alpha3","3.0.0-alpha4","3.0.0-alpha5","3.0.0-beta1","3.0.0-beta2","3.0.0-beta3","3.0.0-beta4","3.0.0-beta6","3.0.0-beta7","3.0.0-rc1","3.0.0-rc2","3.0.0-rc3","3.0.0-rc4","3.0.0-rc5","3.3.7"]
npm ERR! at installTargetsError (/home/admin/.nodes/0.10.17/lib/node_modules/npm/lib/cache.js:719:10)
npm ERR! at next (/home/admin/.nodes/0.10.17/lib/node_modules/npm/lib/cache.js:698:17)
npm ERR! at /home/admin/.nodes/0.10.17/lib/node_modules/npm/lib/cache.js:675:5
npm ERR! at saved (/home/admin/.nodes/0.10.17/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /home/admin/.nodes/0.10.17/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "/home/admin/.nodes/current/bin/node" "/home/admin/.nodes/current/bin/npm" "install" "express"
npm ERR! cwd /home/admin/M101JS/Week 2/hw2/hw2-3/blog
npm ERR! node -v v0.10.17
npm ERR! npm -v 1.3.8
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/admin/M101JS/Week 2/hw2/hw2-3/blog/npm-debug.log
npm ERR! not ok code 0
I am new to NodeJS and NPM, so I don't understand the response.
Does anyone have an idea how I can fix it?
You want to run the latest node (currently 0.10.22). Try these steps to get the newest version:
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs -y # newer nodejs package includes npm
And then try again on npm install express.
Update your npm
npm install -g npm
This was a bug in an earlier version of npm: https://github.com/npm/npm/issues/4984
You may get warnings when you update. Run the update one more time and you should see a clean npm install.
While the solution by #Jim worked well, if you feel the need to update NodeJS, you can do so via the n package:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
If you are sitting in corporate network then worth pointing registry to your corporate registry/artifactory and trying.
npm config set registry