Hyperledger Fabric: ERROR! 404 - The requested fabric-chaincode-api package (version 1.4.5) could not be found on the npm registry

I created my chaincode using Node.js API and now I'm attempting to perform the instantiation process.

docker image: hyperledger/fabric-peer:1.4.5

In my package.json file, here is what I have included:

{
    "name": "democontract",
    "version": "1.0.0",
    "description": "Document Contract",
    "main": "index.js",
    "engines": {
        "node": ">=8.4.0",
        "npm": ">=5.3.0"
    },
    "scripts": {
        "lint": "eslint .",
        "pretest": "npm run lint",
        "start": "fabric-chaincode-node start",
        "mocha": "mocha test --recursive"
    },
    "engine-strict": true,
    "license": "Apache-2.0",
    "private": true,
    "dependencies": {
        "mkdirp": ">=0.5.5",
        "openpgp": "^4.10.0",
        "fabric-chaincode-api": "^1.4.0",
        "fabric-shim": "^1.4.0"
    },
    "devDependencies": {
        "chai": "^4.1.2",
        "chai-as-promised": "^7.1.1",
        "eslint": "^4.19.1",
        "mocha": "^5.2.0",
        "nyc": "^12.0.2",
        "sinon": "^6.0.0",
        "sinon-chai": "^3.2.0"
    }
}

However, when I try to instantiate the chaincode (democontract) in the CLI container:

peer chaincode instantiate -C $CHANNELNAME -n $CHCODENAME -v $CHCODEVERSION -o $ORDERERNAME \
    -c '{"Args":["ContractDocument:instantiate"]}' \
    -P "OR('OrdererMSP.admin','Org1MSP.admin','Org1MSP.peer','Org1MSP.member')" \
    --tls --cafile $ORDERER_TLSCACERT --tlsRootCertFiles $CORE_PEER_TLS_ROOTCERT_FILE

I encounter an ERROR at the PEER container, causing the chaincode instantiation to fail.

I am unsure how to resolve this error condition. Can someone please assist me?

[endorser] SimulateProposal -> ERRO 050 [devchannel][bef25398] failed to invoke chaincode name:"lscc" , error: Failed to generate platform-specific docker build: 
Error returned from build: 1 "npm WARN deprecated mkdirp: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated https://github.com/lydell/resolve-url#deprecated
npm ERR! code E404
**npm ERR! 404 Not Found - GET https://registry.npmjs.org/fabric-chaincode-api - Not found**
npm ERR! 404 
npm ERR! 404  'fabric-chaincode-api@^1.4.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'output'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-05-18T19_31_20_461Z-debug.log
"
error starting container
error starting container

Best Regards, Magno A. Cavalcante

Answer №1

If you're encountering issues, it could be due to an outdated version of Node.js. Make sure to verify the compatibility between your Node.js version and Hyperledger Fabric versions.

Answer №2

The issue lies within the package.json file.

An error was found in the following code snippet:

"dependencies": {
    "mkdirp": ">=0.5.5",
    "openpgp": "^4.10.0",
    "fabric-chaincode-api": "^1.4.0",
    "fabric-shim": "^1.4.0"
},

The correct version should be as follows:

"dependencies": {
    "mkdirp": ">=0.5.5",
    "openpgp": "^4.10.0",
    "fabric-contract-api": "^1.4.3",
    "fabric-shim": "^1.4.3"
},

The adjustment changed from fabric-chaincode-api to fabric-contract-api.

I structured my package.json based on packages detailed in this URL: .

For future reference, you can check out the following URLs:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is it possible to exclude specific URLs from CSRF protection in sails.js?

I am currently integrating Stripe with my sails.js server and need to disable CSRF for specific URLs in order to utilize Stripe's webhooks effectively. Is there a way to exempt certain URLs from CSRF POST requirements within sails.js? I have searched ...

Accessing specific documents in Firebase cloud functions using a wildcard notation

Currently, I am working on implementing Firebase cloud functions and here are the tasks I need to achieve: Monitoring changes in documents within the 'public_posts' collection. Determining if a change involves switching the value of the &ap ...

The default value for the ReturnType<typeof setInterval> in both the browser and node environments

I have a question about setting the initial value for the intervalTimer in an Interval that I need to save. The type is ReturnType<typeof setInterval>. interface Data { intervalTimer: ReturnType<typeof setInterval> } var data : Data = { ...

Transmitting a Commitment as a Response in the HTTP protocol

I'm diving deeper into the world of promises in javascript. I grasp the fundamental syntax where promises are used by clients for handling asynchronous tasks like this: async function fetchMovies() { const response = await fetch('/movies') ...

Balancing the Demands on a Node

We are currently managing a C# Web API server and a Node Express server. Our C# server sends multiple requests to a specific route on the Node server, which performs complex tasks and often takes 6-8 seconds to complete. However, when we send hundreds of ...

Encountering a NextJS Error while trying to render a page, following a recent post

Recently, I encountered an issue with my Next.js application that is connected to my NodeJS API. I have a form on one of the pages that sends POST requests to the backend API. However, upon submitting the form and being redirected to another page, pressin ...

How can I pass an object into EJS templates from views in Express 3.x?

Currently, I am utilizing ejs templates in combination with node.js and express 3.x. Is there a way to display the data object that is passed into the view? Can it be achieved similar to this example in index.ejs: <%= dump(session) %> ...

Tips for rectifying the issue encountered during the deployment of a smart contract in Ethereum

While attempting to compile the smart contract using solc-js, I encountered the following error message: Krishna:Voting krishnakankipati$ node deploy.js Compiling the contract assert.js:350 throw err; ^ AssertionError [ERR_ASSERTION]: Invalid c ...

Understanding the process of parsing an array in form-data in Node.js

https://i.stack.imgur.com/FPhX1.png I'm currently facing an issue while trying to read the image above in Node.js. I am using Express.js and have attempted to debug req.body, but it is returning an empty object {}. Even though I am using app.use(bod ...

Error: The function "parse" is not defined

After installing the Font Awesome dependencies for my app and attempting to run npm start to test it, I encountered a troublesome error that has proven to be quite challenging to solve. $ npm start > <a href="/cdn-cgi/l/email-protection" class="__cf ...

Merging two distinct arrays of objects in JavaScript can be achieved by utilizing various methods and

I have a challenge where I need to merge two arrays of objects in a nested way. var array1=[{ PersonalID: '11', qusetionNumber: '1', value: 'Something' }, { PersonalID: '12', qusetionNumber: '2& ...

Steps to ensure that MongoClient is accessible globally on all pages within a Node.js REST API

After researching the official MongoDB documentation, I have successfully integrated mongoDB into my NodeJS REST API using the following connection code. const { MongoClient } = require("mongodb"); // Connection URI const uri = "mongodb+s ...

The npm encountered an error with code ENOENT and an error number of 34

Here is my initial script setup for a React project. "scripts": { "prestart": "babel-node tools/startMessage.js", "start": "npm-run-all --parallel test:watch open:src lint:watch", "open:src": "babel-node tools/srcServer.js", "lint": "node_ ...

Is there a way to search for multiple items using just one search term?

On my app, there is a search bar that currently only looks up data for one specific attribute. For example, if I type in "Hammer," it only searches for Tool names. Now, I need to expand the search functionality to accommodate different types of strings. F ...

Unable to locate the JSON file in the req.body after sending it through an HTTP post request

I have been working on implementing a new feature in my application that involves passing a JSON file from an Angular frontend to a Node backend using Express. The initial code reference can be found at How do I write a JSON object to file via Node server? ...

Properly encoding strings in Node.js

In my NodeJS code, I am dealing with the following string: '3&#xAA; Jornada: Resumen 2' which is meant to be displayed as: '3ª Jornada: Resumen 2' I have attempted to convert it using the decodeURIComponent(escape(myString)) ...

Why is middleware being triggered even if the specified mount path is not its own?

As a beginner in the world of node and express, I am delving into exploration. Recently, I created two middleware functions each with its own mount path. Surprisingly, MIDDLEWARE 2 is being invoked even when the incoming request is not intended for it. ...

Execute a function that returns a promise in a Node.js chain using the .then method

Greetings, I am relatively new to working with asynchronous calls and could really benefit from some assistance. I have encountered an issue within a .then chain where I intend to call a function that returns a promise in the middle of the chain. However, ...

Generate a fresh DOM element when a particular height threshold is achieved, utilizing a portion of the previous DOM element's content

Update: 27th December 2016 The heading has been modified because any DOM element can be the target, whether it is a <p> element or not. Additional information has been provided about the tools being used and the desired outcome. Are there nativ ...

The NPM update command encountered numerous warnings but ultimately completed successfully

Recently, I dove into the world of NPM packages and encountered some issues with dependencies. Fortunately, this community provided great assistance in resolving them. However, a new challenge arose when attempting to update the CLI application. Interestin ...