This is the error I get.
internal/modules/cjs/loader.js:631 throw new ERR_INVALID_ARG_TYPE('id', 'string', id); ^
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object at Module.require (internal/modules/cjs/loader.js:631:11) at require (internal/modules/cjs/helpers.js:20:18)
This is the Code:
const Web3 = require('web3');
const contract = require('truffle-contract');
const fs = require('fs');
const Artifacts = require('../build/contracts/Organ.json');
const contract = contract(Artifacts);
var app;
var accounts;
var account;
const web3 = new Web3(new
Web3.providers.HttpProvider('http://127.0.0.1:8545'));
contract.setProvider(web3.currentProvider);
if (typeof contract.currentProvider.sendAsync !== 'function') {
contract.currentProvider.sendAsync = async () =>
await contract.currentProvider.send.apply(
contract.currentProvider,
arguments
);
}
contract.deployed();
The issue is with the .deplyed() part, everything run properly before that. Everything works fine in the truffle console.