Error while running fabcar sample in javascript [duplicate] - docker

This question already has answers here:
Network calls fail during image build on corporate network
(9 answers)
Closed 3 years ago.
I am trying to run fabcar sample using javascript chaincode,it fails with the following error while instantiating the chaincode
error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/fabric-shim failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
please help me regarding this...
It is happenning for all fabric samples whenever i try to run in javascript/typescript
thanks in advance

When you instantiate a Javascript Smart Contract the Fabric creates a chaincode container and installs your Javascript contract (or sample) AND all the npm dependencies. This means that an npm registry with those modules must be accessible.
I suspect that you are behind a corporate proxy/firewall, or working in a region where there is no direct access to npm. On your host machine you probably have a .npmrc file which helps with the proxy, and you need to replicate that for the chaincode.
I think you need to place the .npmrc file in the root folder of your Smart Contract project - i.e. in the same folder as the package.json file.

Related

Docker getting error FATAL EISDIR: illegal operation on a directory, read

Stumbled across this error as I try to run NPM on my docker container.
FATAL EISDIR: illegal operation on a directory, read 19:05:13
at Object.readSync (node:fs:723:3)
at tryReadSync (node:fs:433:20)
at Object.readFileSync (node:fs:479:19)
at loadEnv (node_modules/#nuxt/config/dist/config.js:1152:78)
at Object.loadNuxtConfig (node_modules/#nuxt/config/dist/config.js:1070:15)
at loadNuxtConfig (node_modules/#nuxt/cli/dist/cli-index.js:338:32)
at NuxtCommand.getNuxtConfig (node_modules/#nuxt/cli/dist/cli-index.js:463:26)
at Object.run (node_modules/#nuxt/cli/dist/cli-start.js:115:30)
at NuxtCommand.run (node_modules/#nuxt/cli/dist/cli-index.js:413:22)
So in my case npm install worked just fine....when you try to run
the app with npm run start your greeted with the above error.
What it was not:
File permission issue - was running command as root
.npmrc in the same directory or user directory issue
Solution
Add all your python virtual environment folders to .dockerignore in my case i wasn't even copying the virtual environment folder to my docker container. Its existence is what caused the issue.
Example
.dockerignore
/api/.env
Its weird and I don't know why this is happening...but i spent days trying to figure out why my build worked on deployment but wouldn't work locally - python virtual environments are ignored during deployment so they were never there during cloud build thats why it worked.
Here is more resource regarding the issue however these did not work for me:
https://github.com/yarnpkg/yarn/issues/4336
NPM stuck giving the same error EISDIR: Illegal operation on a directory, read at error (native)

Hostname/IP does not match certificate's altnames: Host: registry.npmjs.org. is not in the cert's altnames

I have a Ubuntu server running Apache Tomcat with SSL for a domain (e.g abc.xyz). In that server, I also set up Docker for deploying Next.js. However, when I build a container for a demo application, it shows error:
npm ERR! code ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! errno ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! request to https://registry.npmjs.org/#types%2fnode failed, reason: Hostname/IP does not match certificate's altnames: Host: registry.npmjs.org. is not in the cert's altnames: DNS:*.abc.xyz, DNS:abc.xyz
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-11-06T15_27_49_018Z-debug.log
I tried many solutions like setting strict-ssl=false, setting registry (you can see it in my repository), changing DNS nameserver to OpenDNS but they don't work.
I also tried to run command npm install outside Docker and it still works.
Repository URL here.
Updated: This error doesn't occur not only in Nodejs but also in Java. I built a Dockerfile that contains RUN mvn package and it shows the same error
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6:
Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom:
Certificate for <repo.maven.apache.org> doesn't match any of the subject alternative names: [*.abc.xyz, abc.xyz] -> [Help 1]

Docker - Error: EEXIST: file already exists, symlink

I have developed a small "proof of concept" ApostropheCMS application. The application runs fine with node app.js. I'm trying to build and deploy with Docker for Windows on Windows 7 with Oracle VM VirtualBox following this tutorial.
I am able to deploy the mongo image. I am able to build my application image using the default Dockerfile. When I attempt to run my application, docker image linked with the mongo image I receive the following error:
$ docker run --link=ato-home-db:mongodb -p 3000:3000 ato-home-webapp
ato-home-webapp#2.0.0 start /app node app.js fs.js:1014 return
binding.symlink(preprocessSymlinkDestination(target, type, path),
^ Error: EEXIST: file already exists, symlink '/app/node_modules/apostrophe/lib/modules/apostrophe-assets/public' ->
'/app/public/modules/apostrophe-assets'
at Object.fs.symlinkSync (fs.js:1014:18)
at Object.self.linkAssetFolderOnUnix (/app/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:646:10)
at Object.self.linkAssetFolder (/app/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:612:14)
at /app/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:578:14
at /app/node_modules/#sailshq/lodash/lib/index.js:3253:15
at baseForOwn (/app/node_modules/#sailshq/lodash/lib/index.js:2223:14)
at /app/node_modules/#sailshq/lodash/lib/index.js:3223:18
at Function. (/app/node_modules/#sailshq/lodash/lib/index.js:3526:13)
at self.symlinkModules (/app/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:574:9)
at /app/node_modules/async/lib/async.js:718:13
at iterate (/app/node_modules/async/lib/async.js:262:13)
at async.forEachOfSeries.async.eachOfSeries (/app/node_modules/async/lib/async.js:281:9)
at _parallel (/app/node_modules/async/lib/async.js:717:9)
at Object.async.series (/app/node_modules/async/lib/async.js:739:9)
at Object.self.afterInit (/app/node_modules/apostrophe/lib/modules/apostrophe-assets/index.js:521:20)
at invoke (/app/node_modules/apostrophe/index.js:423:23) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! ato-home-webapp#2.0.0 start:
node app.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
ato-home-webapp#2.0.0 start 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!
/root/.npm/_logs/2018-08-07T00_15_24_396Z-debug.log
I'm hoping for a possible solution or suggestions for ApostropheCMS tutorials or "How Tos" to get past this roadblock.
I am new to ApostropheCMS and Docker. Any input would be greatly appreciated. I can supply additional information if helpful.
I'm going to assume that you're building your image on Windows (to a Linux container). Please try rebuilding your image in a Unix environment.

unable to close private repo during docker build [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I’m running into a interesting problem…
I need to clone a private git repo during a docker build. To do this, I’m passing my ssh keys from my local machine (mac pro) into the image using build-arg. Keys have been added to git. This process works locally.
I’m now trying to replicate this process with an ubuntu VM as the docker host. I’ve generated keys and am able to connect to git and clone from the repo from the ubuntu host. However, when passing the keys during the docker build it errors out. docker image is node:9 Anyone have an idea of what would cause this?
npm ERR!
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128 (edited)`
SOLVED!
created config file under ~/.ssh/
Host <url>
User git
StrictHOstKeyChecking no

Visual Studio 2015 Remote iOS Build Server Setup - secure mode issue

I am building a hybrid mobile app (Cordova) and I am trying to run my build on iOS.
I have followed the steps in this documentation to setup my connected Mac and I can see that the Mac terminal responding when I try to build my code in visual studio.
My issue is that when ever I enable the remote build server using remotebuild --secure false I get the following error in visual studio output(notice that the terminal is responding to the build request from visual studio but then fails with errors):
Non-secure connection to http://192.168.1.10:3000/cordova could not be established. Verify that the build server is not running in secure mode.
And here is the Mac terminal activity with and output:
Last login: Tue Aug 18 19:31:21 on ttys001
IBRAHIM-ALHUSSAINs-Mac-mini:~ IBRAHIMALHUSSAIN$ remotebuild --secure false
remotebuild
Copyright (C) 2014 Microsoft Corporation. All rights reserved.
1.0.1
Warning: No server modules selected. Defaulting to configuration "modules": {"taco-remote": { "mountPath": "cordova"} }
Build Retention initialized with baseBuildDir /Users/IBRAHIMALHUSSAIN/.taco_home/remote-builds/taco-remote/builds, maxBuildsToKeep 20
Initialized BuildManager with baseBuildDir /Users/IBRAHIMALHUSSAIN/.taco_home/remote-builds/taco-remote/builds; maxBuildsInQueue 10; deleteBuildsOnShutdown true; allowsEmulate true; nextBuildNumber 423
Remote build server listening on [http] port 3000
express deprecated req.host: Use req.hostname instead ../../usr/local/lib/node_modules/remotebuild/lib/server.js:257:81
GET /modules/taco-remote 200 14.494 ms - 7
New build request submitted:
/build/tasks?command=build&vcordova=4.3.0&cfg=debug&loglevel=warn
{ 'accept-language': 'en-US',
host: '192.168.1.10:3000',
connection: 'close',
'transfer-encoding': 'chunked' }
POST /cordova/build/tasks?command=build&vcordova=4.3.0&cfg=debug&loglevel=warn - - ms - -
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "taco-remote-multiplexer"
npm ERR! node v0.12.4
npm ERR! npm v2.13.4
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org
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! /Users/IBRAHIMALHUSSAIN/.taco_home/node_modules/taco-remote-multiplexer/latest/npm-debug.log
I remember reading somewhere that I should enable secure build once then disable it in order to initialize the remote server security configuration. Whenever I try to run in secure build mode remotebuild I would get this error:
Secure connection to https://192.168.1.10:3000/cordova could not be established. Verify that the build server is running in secure mode.
I have also attempted to resolve this issue by recreating PIN, generating and resetting the certificate.
How can I resolve this issue?
From the console output that you've included there, it looks like your mac can't access the npm repository:
npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org
The line stating
New build request submitted
indicates that visual studio has successfully connected to the remotebuild server and has sent over a project to be built. As part of building a project, remotebuild dynamically acquires some npm packages to make sure that it is future proof and can work with multiple different versions of Cordova.
If you are unable or unwilling to let your mac see the npm repository, then it is possible to provide your own substitute function that determines what package to load to actually build the project.
I strongly recommend against doing this, but here is the simplest way to remove the functionality:
On a machine with access to npm, "npm install taco-remote-lib" to download the default package that performs cordova builds for remotebuild, then within that "npm install cordova#<version>" for the single version you intend to use. Open up taco-remote-lib/ios/iosBuild.js and replace
TacoPackageLoader.lazyRequire("cordova", "cordova#" + cordovaVersion, buildInfo.logLevle).done(function pkg) {
cordova = pkg;
with
cordova = require("cordova");
and remove the "}, function (err) { [...] })" at the end of the function you removed.
Copy the whole taco-remote-lib folder onto the mac, as it is now a self-contained instance which is specialised to a particular cordova version
Create a new js file somewhere "myRedirector.js", and give it contents similar to the following:
.
module.exports.getPackageToServeRequest = function (request) {
return require("/path/to/copied/taco-remote-lib");
}
Create a configuration file that looks something like the following:
.
{
"modules": {
"taco-remote": {
"requirePath": "taco-remote",
"mountPath": "cordova",
"redirector": "/path/to/myRedirector.js",
}
}
}
Start remotebuild by running "remotebuild --config path/to/the/config.json"
This should start remotebuild with a custom request redirector that uses your custom modified taco-remote-lib package to build all requests.
This will not respect the version of cordova that VS specifies for builds, since that requires the ability to download those versions from NPM on demand.
perhaps because of OS have Sandbox system
In my case I had "'" in my mac's name. It did connect by host name once I removed "'".

Resources