node-gyp rebuild error on docker hyperledger indy - dockerfile

I am using hyperledger indy for my thesis. Indy runs on docker. But whenever I try to build my docker-compose, npm install command in agentDockerfile throws node-gyp rebuild error.I am installing node v10.Can anyone please help?
My agentDockerfile
FROM bcgovimages/von-image:py36-1.6-8
USER root
# Install nodejs
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y \
nodejs \
build-essential
USER indy
WORKDIR $HOME
RUN mkdir nodejs
WORKDIR nodejs
ENV LD_LIBRARY_PATH=$HOME/.local/lib:/usr/local/lib:/usr/lib
# Get the dependencies loaded first - this makes rebuilds faster
COPY --chown=indy:indy package.json .
RUN npm install
# Copy rest of the app
COPY --chown=indy:indy . .
RUN chmod uga+x scripts/* bin/*
CMD [ "npm", "start" ]
EXPOSE 8000
error:
> indy-sdk#1.6.1 install /home/indy/nodejs/node_modules/indy-sdk
> node-gyp rebuild
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: connect ETIMEDOUT 104.20.22.46:443
gyp ERR! stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
gyp ERR! System Linux 5.10.0-kali3-amd64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/indy/nodejs/node_modules/indy-sdk
gyp ERR! node -v v8.17.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN The package just-extend is included as both a dev and production dependency.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! indy-sdk#1.6.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the indy-sdk#1.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/indy/.npm/_logs/2021-07-04T09_53_53_155Z-debug.log
ERROR: Service 'alice' failed to build: The command '/bin/sh -c npm install' returned a non-zero code: 1
Package.json:
{
"name": "indy-agent",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"test": "mocha test/**/*.js"
},
"dependencies": {
"cookie-parser": "~1.4.3",
"debug": "~2.6.9",
"ejs": "~2.5.7",
"express": "~4.16.0",
"express-session": "^1.15.6",
"home-dir": "^1.0.0",
"http-errors": "~1.6.2",
"indy-sdk": "1.6.1",
"json-stringify-pretty-compact": "^1.2.0",
"morgan": "~1.9.1",
"request": "^2.87.0",
"request-promise": "^4.2.2",
"request-promise-native": "^1.0.5",
"session-file-store": "^1.2.0"
},
"devDependencies": {
"chai": "^4.1.2",
"mocha": "^5.1.1",
"sinon": "^5.0.7",
"just-extend": ">=4.0.0"
}
}
I am using Ubuntu 20.04

Related

Elastic Beanstalk EBS NPM Bower install is failing

Having an issue with my EBS deployment. Getting this output everytime it tries to deploy the build.
Application deployment failed at 2018-07-02T02:46:14Z with exit status 1 and error: command npm_install_bower in .ebextensions/bower.config failed.
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/bower
npm ERR! Error: UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! at SecurePair.<anonymous> (tls.js:1430:32)
npm ERR! at SecurePair.emit (events.js:92:17)
npm ERR! at SecurePair.maybeInitFinished (tls.js:1029:10)
npm ERR! at CleartextStream.read [as _read] (tls.js:521:13)
npm ERR! at CleartextStream.Readable.read (_stream_readable.js:341:10)
npm ERR! at EncryptedStream.write [as _write] (tls.js:418:25)
npm ERR! at doWrite (_stream_writable.js:226:10)
npm ERR! at writeOrBuffer (_stream_writable.js:216:5)
npm ERR! at EncryptedStream.Writable.write (_stream_writable.js:183:11)
npm ERR! at write (_stream_readable.js:602:24)
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 4.14.47-56.37.amzn1.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /opt/elasticbeanstalk/eb_infra
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/elasticbeanstalk/eb_infra/npm-debug.log
npm ERR! not ok code 0.
bower.config file is:
commands:
get_sudo:
command: echo Defaults:root \!requiretty >> /etc/sudoers
npm_install:
command: sudo yum -y --enablerepo=epel install nodejs npm
npm_install_bower:
command: sudo npm install -g bower
container_commands:
01_bower_install:
command: "export PATH=$PATH; $NODE_HOME/bin/node ./node_modules/bowe/bin/bower -V install --allow-root -F > /tmp/01_bower_install.log"
Tried it without 01_bower_install part as well but same result. Fails to deploy. Was working fine until 2 days ago on the instance and now showing:
Forbidden You don't have permission to access / on this server.
..on the URL.
Help greatly appreciated!
I spent few hours today on the same issue, bower would not be installed by npm and would not run. Eventually got it work as follows:
1) remove "bower" from package.json
2) here is my ebextension file that managed to install bower and run it, by making it a global command:
container_commands:
install_bower:
command: "export PATH=$PATH:$NODE_HOME/bin; npm install bower -g; bower install --allow-root"
Cheers,
Z.

Laravel 5.5 API Authentication (Passport) - cross-env: not found error, when i run npm run dev

I have tried to implement laravel passport authentication in my project, but it's not working. Initially, i have installed laravel5.5 with other configuration and file permissions all the stuff.
To implement passport authentication I have followed laravel documentation Document Url
Following steps, I have done,
composer require laravel/passport
php artisan migrate
php artisan passport:install
I have added this line App\User
use Laravel\Passport\HasApiTokens;
use HasApiTokens, Notifiable;
Routes Added in AuthServiceProvider file inside the boot function
Passport::routes();
Inside the config/auth.php file, I have changed API driver as passport
php artisan vendor:publish --tag=passport-components
Inside this file resources/assets/js/app.js
Vue.component(
'passport-clients',
require('./components/passport/Clients.vue')
);
Vue.component(
'passport-authorized-clients',
require('./components/passport/AuthorizedClients.vue')
);
Vue.component(
'passport-personal-access-tokens',
require('./components/passport/PersonalAccessTokens.vue')
);
npm run dev
When running this command I'm getting an error
$ npm run dev
# dev /var/www/html/local/laravel5.5
npm run development
# development /var/www/html/local/laravel5.5
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
sh: 1: cross-env: not found
npm ERR! Linux 4.4.0-98-generic
npm ERR! argv "/home/sysadmin/.nvm/versions/node/v6.11.1/bin/node" "/home/sysadmin/.nvm/versions/node/v6.11.1/bin/npm" "run" "development"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! # development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the # development script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/local/laravel5.5/npm-debug.log
npm ERR! Linux 4.4.0-98-generic
npm ERR! argv "/home/sysadmin/.nvm/versions/node/v6.11.1/bin/node" "/home/sysadmin/.nvm/versions/node/v6.11.1/bin/npm" "run" "dev"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! # dev: npm run development
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script 'npm run development'.
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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run development
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/local/laravel5.5/npm-debug.log
You must run in cmd/terminal, from your project folder
npm install --save
and then
npm run dev

Hyperledger composer test code

I was following the instructions on IBM hyperledger composer developer guide, but when I did compiling, it failed and appeared this error.
> mocha -t 0 --recursive && cucumber-js
Sample
1) "before each" hook for "Alice can read all of the assets"
0 passing (912ms)
1 failing
1) Sample "before each" hook for "Alice can read all of the assets":
SyntaxError: Failed to parse /Users/calvinlin007/Documents/hyperledger-composer/my-network/lib/sample.js: The keyword 'const' is reserved (17:0)
at new Script (node_modules/composer-common/lib/introspect/script.js:55:27)
at ScriptManager.createScript (node_modules/composer-common/lib/scriptmanager.js:61:16)
at Object.process (node_modules/composer-common/lib/businessnetworkdefinition.js:507:69)
at Function.processFile (node_modules/composer-common/lib/businessnetworkdefinition.js:578:27)
at items.forEach (node_modules/composer-common/lib/businessnetworkdefinition.js:563:39)
at Array.forEach (native)
at Function.processDirectory (node_modules/composer-common/lib/businessnetworkdefinition.js:562:15)
at Function.fromDirectory (node_modules/composer-common/lib/businessnetworkdefinition.js:498:35)
at adminConnection.createProfile.then.then (test/sample.js:66:50)
npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test-inner"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! my-network#0.1.6 test-inner: `mocha -t 0 --recursive && cucumber-js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-network#0.1.6 test-inner script 'mocha -t 0 --recursive && cucumber-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 my-network package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! mocha -t 0 --recursive && cucumber-js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs my-network
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-network
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/calvinlin007/Documents/hyperledger-composer/my-network/npm-debug.log
npm ERR! Test failed. See above for more details.
This is my .eslintrc.yml configuration
env:
es6: true
node: true
mocha: true
extends: 'eslint:recommended'
parserOptions:
ecmaVersion: 2015
sourceType:
- script
Cuz I have searched the problem and it should be EMCAScript version,
but I tried changing it and it didn't work.
I've checked my macOS is 10.12. and here's my package.json
{
"engines": {
"composer": "^0.11.0 || ^0.12.0 || ^0.13.0"
},
"name": "my-network",
"version": "0.1.6",
"description": "My Commodity Trading network",
"networkImage": "https://hyperledger.github.io/composer-sample-networks/packages/basic-sample-network/networkimage.svg",
"networkImageanimated": "https://hyperledger.github.io/composer-sample-networks/packages/basic-sample-network/networkimageanimated.svg",
"scripts": {
"prepublish": "mkdirp ./dist ; composer archive create --sourceType dir --sourceName . -a ./dist/my-network.bna",
"pretest": "npm run lint",
"lint": "eslint .",
"postlint": "npm run licchk",
"licchk": "license-check",
"postlicchk": "npm run doc",
"doc": "jsdoc --pedantic --recurse -c jsdoc.json",
"test-inner": "mocha -t 0 --recursive && cucumber-js",
"test-cover": "nyc npm run test-inner",
"test": "npm run test-inner"
},
"repository": {
"type": "git",
"url": "https://github.com/hyperledger/composer-sample-networks.git"
},
"keywords": [
"sample",
"composer",
"composer-network"
],
"author": "Hyperledger Composer",
"license": "Apache-2.0",
"devDependencies": {
"browserfs": "^1.2.0",
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"composer-admin": "^0.11.0",
"composer-cli": "^0.11.0",
"composer-client": "^0.11.0",
"composer-connector-embedded": "^0.11.0",
"composer-cucumber-steps": "^0.11.0",
"cucumber": "^2.2.0",
"eslint": "^3.6.1",
"istanbul": "^0.4.5",
"jsdoc": "^3.4.1",
"license-check": "^1.1.5",
"mkdirp": "^0.5.1",
"mocha": "^3.2.0",
"moment": "^2.17.1",
"nyc": "^11.0.2"
},
"license-check-config": {
"src": [
"**/*.js",
"!./coverage/**/*",
"!./node_modules/**/*",
"!./out/**/*",
"!./scripts/**/*"
],
"path": "header.txt",
"blocking": true,
"logInfo": false,
"logError": true
},
"nyc": {
"exclude": [
"coverage/**",
"features/**",
"out/**",
"test/**"
],
"reporter": [
"text-summary",
"html"
],
"all": true,
"check-coverage": true,
"statements": 100,
"branches": 100,
"functions": 100,
"lines": 100
}
}
Does anyone know how to solve this problem ## ?
on your first problem - the sample.js test script - you have copied the Unit Test script contents into lib/sample.js and that is why you have your problems - ie 'const' error - that file is the Transaction Processor functions script. You should (as per the Developer Tutorial) paste the Unit test script into the file located at test/sample.js. I think perhaps the fact that the filenames (in both 'lib' and 'test' subdirectories) are the same, has caused some confusion - think I will get that changed to improve user experience. The other Angular error (mentioned earlier) still stands.
On your second posting (Angular module errors). A local Composer playground install has dependencies on Angular (note the Developer guide uses the online playground). Check out package.json for that list of angular dependencies. Doesn't look like your playground installed correctly, if its showing missing dependencies (#angular/core etc) Suggest to clear down docker ps -aq | xargs docker rm -f and docker images -aq | xargs docker rmi -f (warning: clears down all docker containers in your dev environment) then install it (as a non-privileged user) using the one-liner - ie npm uninstall -g composer-playground - installs playground in a docker container using the command curl -sSL https://hyperledger.github.io/composer/install-hlfv1.sh | bash .
This is what npm list command returns
Calvinde-MacBook-Air:my-network calvinlin007$ npm list -g --depth=0
/usr/local/lib
├── composer-cli#0.12.2
├── composer-playground#0.12.2
├── composer-rest-server#0.12.2
├── generator-hyperledger-composer#0.12.2
├── npm#3.10.10
└── yo#2.0.0
npm ERR! peer dep missing: #angular/core#^4.0.3, required by #ng-bootstrap/ng-bootstrap#1.0.0-beta.2
npm ERR! peer dep missing: #angular/core#>=4.0.0, required by ngx-clipboard#8.0.4
npm ERR! peer dep missing: #angular/common#^4.0.3, required by #ng-bootstrap/ng-bootstrap#1.0.0-beta.2
npm ERR! peer dep missing: #angular/common#>=4.0.0, required by ngx-clipboard#8.0.4
npm ERR! peer dep missing: #angular/forms#^4.0.3, required by #ng-bootstrap/ng-bootstrap#1.0.0-beta.2
npm ERR! peer dep missing: #angular/platform-browser#>=4.0.0, required by ngx-clipboard#8.0.4
npm ERR! peer dep missing: core-js#>=2.4.1, required by ngx-clipboard#8.0.4
npm ERR! peer dep missing: #angular/core#>=2.4.1, required by ngx-window-token#0.0.2
npm ERR! peer dep missing: #angular/common#>=2.4.1, required by ngx-window-token#0.0.2
npm ERR! peer dep missing: #angular/platform-browser#>=2.4.1, required by ngx-window-token#0.0.2
npm ERR! peer dep missing: core-js#>=2.4.1, required by ngx-window-token#0.0.2

'ionic-app-scripts' is not recognized as an internal or external command, operable program or batch file

i am updating the ionic version to latest, i try to run the my old project i am getting this errors
'ionic-app-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\user\AppData\R
oaming\npm\node_modules\npm\bin\npm-cli.js" "run" "ionic:serve" "--" "--v2"
"--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! node v7.2.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world# ionic:serve: ionic-app-scripts serve "--v2" "--addr
ess" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world# ionic:serve script 'ionic-app-scripts
serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"'.
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 ionic-hello-world pac
kage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100
" "--livereload-port" "35729"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\user\Desktop\demoProj\npm-debug.log
There was an error serving your Ionic application: There was an error with the s
pawned command: serve
Hi please see my answer to this question:
'ionic-app-scripts' is not recognized as an internal or external command,
As stated in the answer, my problem was that I was trying to transfer a project from a mac to a windows machine.

Unable to install Ember.js

I am trying to install Ember CLI but I am getting error, I am not getting what exactly I need to do.
I am running the below command to install Ember CLI in my C drive:
npm install -g ember-cli
I am getting the below error:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ember-cli"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ember-cli"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! path C:\npm-debug.log.9900b075918cf81d21ff4fa7a56e3bc6
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, open 'C:\npm-debug.log.9900b075918cf81d21ff4fa7a56e3bc6'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, open 'C:\npm-debug.log.9900b075918cf81d21ff4fa7a56e3bc6']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\npm-debug.log.9900b075918cf81d21ff4fa7a56e3bc6' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! C:\npm-debug.log
UPDATED:
C:\>npm install -g ember-cli
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ember-cli"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! Please include the following file with any support request:
npm ERR! C:\npm-debug.log
I have solved the problem. It was mainly because of the network issues. I have enabled a proxy to be used by node for downloading the files.
This is happening because to install something globally with npm you have to be root or an administrator. In windowns right click on the terminal app and click the run as administrator option. On Mac and linux you would just put sudo before the command