dappuniversity / eth-todo-list Goto Github PK
View Code? Open in Web Editor NEWBlockchain Todo App Tutorial Powered by Ethereum Smart Contracts
Blockchain Todo App Tutorial Powered by Ethereum Smart Contracts
When running the demo using npm run dev. I get the following errors. Uncaught TyoeError: Web3 is not a constructor on line 29 of the node dependency truffle-contract.js and Uncaught (in promise) Reference Error: Web3 is not defined at object.loadweb3(appjs:16). I have not modified any of the code. I installed it by typing git clone https://github.com/dappuniversity/eth-todo-list.git. then I type npm install followed by npm run dev.
Hi Gregory,
Thank you for your wonderful explanation. I have successfully the migrated the contract into Ganache.
I am able to load the smart contract after "npm run dev". But when I enter any text into the textbox, it is throwing an error:
web3.min.js:1 Uncaught (in promise) Error: invalid address web3.min.js:1
at u (web3.min.js:1). Here are the screenshots
If you are facing any of the above error(s) then :
web3
"devDependencies": {
"bootstrap": "4.1.3",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-bignumber": "^2.0.2",
"lite-server": "^2.6.1",
"nodemon": "^2.0.15",
"truffle": "^5.4.29",
"@truffle/contract": "4.4.4",
"web3": "1.6.1"
}
<script src="vendor/truffle-contract/dist/truffle-contract.js"></script>
to
<script src="vendor/web3/dist/web3.min.js"></script>
<script src="vendor/@truffle/contract/dist/truffle-contract.min.js"></script>
loadWeb3
loadWeb3: async () => {
window.addEventListener('load', async () => {
// Modern dapp browsers...
if (window.ethereum) {
window.web3 = new Web3(ethereum);
try {
// Request account access if needed
await ethereum.enable();
// Acccounts now exposed
web3.eth.sendTransaction({/* ... */});
} catch (error) {
// User denied account access...
}
}
// Legacy dapp browsers...
else if (window.web3) {
window.web3 = new Web3(web3.currentProvider);
// Acccounts always exposed
web3.eth.sendTransaction({/* ... */});
}
// Non-dapp browsers...
else {
console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
}
});
},
loadAccount
loadAccount: async () => {
const account = await ethereum.request({ method: 'eth_requestAccounts' });
App.account = account[0];
},
loadContract
loadContract: async () =>{
const todoList = await $.getJSON('TodoList.json');
App.contracts.TodoList = TruffleContract(todoList);
App.contracts.TodoList.setProvider(new Web3.providers.HttpProvider("http://127.0.0.1:7545"));
App.todoList = await App.contracts.TodoList.deployed();
},
createTask
createTask: async () => {
App.setLoading(true)
const content = $('#newTask').val()
await App.todoList.createTask(content, {from: App.account})
window.location.reload()
},
toggleCompleted
toggleCompleted: async (e) => {
App.setLoading(true)
const taskId = e.target.name
await App.todoList.toggleCompleted(taskId, {from: App.account})
window.location.reload()
},
truffle(development)> tl.taskCount()
evalmachine.<anonymous>:0
tl.taskCount()
^
Uncaught TypeError: tl.taskCount is not a function
at evalmachine.<anonymous>
at Script.runInContext (node:vm:139:12)
at runScript (C:\Users\hanif\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:366:1)
at Console.interpret (C:\Users\hanif\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:381:1)
at bound (node:domain:421:15)
at REPLServer.runBound [as eval] (node:domain:432:12)
at REPLServer.onLine (node:repl:889:10)
at REPLServer.emit (node:events:390:28)
at REPLServer.emit (node:domain:475:12)
at REPLServer.Interface._onLine (node:readline:487:10)
truffle(development)> tl.taskCount()
evalmachine.<anonymous>:0
tl.taskCount()
^
Uncaught TypeError: tl.taskCount is not a function
at evalmachine.<anonymous>
at Script.runInContext (node:vm:139:12)
at runScript (C:\Users\hanif\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:366:1)
at Console.interpret (C:\Users\hanif\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:381:1)
at bound (node:domain:421:15)
at REPLServer.runBound [as eval] (node:domain:432:12)
at REPLServer.onLine (node:repl:889:10)
at REPLServer.emit (node:events:390:28)
at REPLServer.emit (node:domain:475:12)
at REPLServer.Interface._onLine (node:readline:487:10)
I am able to access the tasks mapping but this is throwing an error and i can't figure out why
When trying to run npm sudo run dev
I get this error message:
`> [email protected] dev /home/zaesar/Escritorio/blockchain/eth-todo-list
lite-server
sh: 1: lite-server: not found
npm ERR! Linux 4.15.0-171-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] dev: lite-server
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] dev script 'lite-server'.
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 eth-todo-list package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! lite-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs eth-todo-list
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls eth-todo-list
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/zaesar/Escritorio/blockchain/eth-todo-list/npm-debug.log
`
Can somebody explain me what is wrong? I'm following the tutorial and everything went fine until this point.
Any help will be appreciate it!
Hi dear Gregory
First off, I'm so thankful for dappuniversity, it is so cool.
I'm new to Blockchain so I read your article about creating a todo list with Ethereum
I wrote my codes exactly you said in your article, but I got an error in the 'formatter.js' file when I want to submit a new task.
This is the error:
Uncaught (in promise) Error: invalid address
Can you help me with that, please?
The function createtask doesnt get called. thats why it doesnt render any tasks because taskcount is under 1. Can somebody help?
I've forked the project and tried deploying a contract via truffle. I follow the tutorial but I am getting an error that states "Uncaught (in promise) Error: TodoList has not been deployed to detected network (network/artifact mismatch)". This is with the code that forked from the original and have not modified.
Thank you Gregory for your lecture series on Ethereum. I am following your instructions.
However, I am unable to get the messages like "Check out Dapp University.com" after loading the client application using Metamask. I have attached the Console message from the browser .
Please help me to solve this issue.
code:
const TodoList = artifacts.require("./TodoList.sol");
contract("TodoList", (accounts) => {
before(async () => {
this.TodoList = await TodoList.deployed();
});
it("deploys successfully", async () => {
const address = await this.todoList.address;
assert.notEqual(address, 0x0);
assert.notEqual(address, "");
assert.notEqual(address, null);
assert.notEqual(address, undefined);
});
});
error:
C:\Users\DELL\eth-todo-list>truffle test
Using network 'development'.
Compiling .\contracts\TodoList.sol...
Contract: TodoList
1) deploys successfully
> No events were emitted
0 passing (36ms)
1 failing
1) Contract: TodoList
deploys successfully:
TypeError: Cannot read properties of undefined (reading 'address')
at Context.<anonymous> (test\TodoList.test.js:9:41)
at C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\testing\testrunner.js:134:1
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Please help me to fix this error at the time of 'truffle test' .
inpage.js:1 You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead.
I am following exact same tutorial, but I keep getting "Web3 is not defined" error in console.
I installed Web3 by "npm install web3" explicitly , but keep getting that error, and hence I cannot connect metamask with Localhost:127.0.0.1/7545.
What should I do ?
I got the existing app.js file as is to work with Metamask by using the following script lines inserted after the meta tags in the html header section:
<!-- The legacy-web3 script must run BEFORE your other scripts. -->
<script src="https://unpkg.com/@metamask/legacy-web3@latest/dist/metamask.web3.min.js"></script>
<!-- Or: -->
<script src="https://unpkg.com/@metamask/legacy-web3@latest/dist/metamask.web3.js"></script>
This prevented me from having to refactor to use the new ethereum provider.
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:222:
In file included from ../../nan/nan_converters.h:67:
../../nan/nan_converters_43_inl.h:22:1: error: no viable conversion from 'Localv8::Context' to 'v8::Isolate '
X(Boolean)
^~~~~~~~~~
../../nan/nan_converters_43_inl.h:18:23: note: expanded from macro 'X'
val->To ## TYPE(isolate->GetCurrentContext())
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:2848:37: note: passing argument to parameter 'isolate' here
Local ToBoolean(Isolate isolate) const;
^
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:222:
In file included from ../../nan/nan_converters.h:67:
../../nan/nan_converters_43_inl.h:40:1: error: no viable conversion from 'Localv8::Context' to 'v8::Isolate '
X(bool, Boolean)
^~~~~~~~~~~~~~~~
../../nan/nan_converters_43_inl.h:37:29: note: expanded from macro 'X'
return val->NAME ## Value(isolate->GetCurrentContext());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:2858:30: note: passing argument to parameter 'isolate' here
bool BooleanValue(Isolate isolate) const;
^
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:223:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:356:37: error: too few arguments to function call, expected 2, have 1
return v8::StringObject::New(value).Asv8::StringObject();
~~~~~~~~~~~~~~~~~~~~~ ^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:5854:3: note: 'New' declared here
static Local New(Isolate* isolate, Local value);
^
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraitsv8::Object >'
assert(persistent().IsNearDeath());
~~~~~~~~~~~~ ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
(__builtin_expect(!(e), 0) ? _assert_rtn(func, FILE, LINE, #e) : (void)0)
^
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:127:26: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraitsv8::Object >'
assert(wrap->handle.IsNearDeath());
~~~~~~~~~~~~~ ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/assert.h:93:25: note: expanded from macro 'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(func, FILE, LINE, #e) : (void)0)
^
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:2818:
../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
data = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:5272:3: note: 'GetContents' has been explicitly marked deprecated here
V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
^
../fsevents.cc:43:32: error: no template named 'Handle' in namespace 'v8'
static void Initialize(v8::Handlev8::Object exports);
~~~~^
In file included from ../fsevents.cc:73:
../src/constants.cc:89:11: error: no matching member function for call to 'Set'
object->Set(Nan::Newv8::String("kFSEventStreamEventFlagNone").ToLocalChecked(), Nan::Newv8::Integer(kFSEventStreamEventFlagNone));
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:90:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagMustScanSubDirs").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagMustScanSubDirs));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:91:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagUserDropped").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagUserDropped));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:92:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagKernelDropped").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagKernelDropped));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:93:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagEventIdsWrapped").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagEventIdsWrapped));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:94:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagHistoryDone").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagHistoryDone));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:95:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagRootChanged").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagRootChanged));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:96:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagMount").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagMount));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:97:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagUnmount").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagUnmount));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:98:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemCreated").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemCreated));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:99:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemRemoved").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemRemoved));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:100:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemInodeMetaMod").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemInodeMetaMod));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
In file included from ../fsevents.cc:73:
../src/constants.cc:101:11: error: no matching member function for call to 'Set'
object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemRenamed").ToLocalChecked(), Nan::New<v8::Integer>(kFSEventStreamEventFlagItemRenamed));
~~~~~~~~^~~
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3670:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/ishpreet/Library/Caches/node-gyp/14.17.0/include/node/v8.h:3673:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [Release/obj.target/fse/fsevents.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:376:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64" "--napi_version=8" "--node_abi_napi=napi"
gyp ERR! cwd /Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node --module_name=fse --module_path=/Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64 --napi_version=8 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:376:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1055:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Darwin 19.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents
node-pre-gyp ERR! node -v v14.17.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node --module_name=fse --module_path=/Users/ishpreet/Documents/Blockchain-Projects/eth-todo-list/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64 --napi_version=8 --node_abi_napi=napi' (1)
npm WARN [email protected] requires a peer of [email protected] - 3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of popper.js@^1.14.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
My code:
loadContract: async () => {
// Create a JavaScript version of the smart contract
const todoList = await $.getJSON('TodoList.json')
App.contracts.TodoList = TruffleContract(todoList)
App.contracts.TodoList.setProvider(App.web3Provider)
// Hydrate the smart contract with values from the blockchain
App.todoList = await App.contracts.TodoList.deployed()
},
Error its showing:
Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'TodoList')
The code is copied exactly, but it tells me that web3 is not defined. It is definitely installed - I've done the npm install and I have installed web3 manually via npm install [email protected]
Any ideas?
I'm unable to add tasks, when i try to add a task it just stucks on the loading state.Neither it gives me a pop up to sign off a transcation. My metamask wallet is connected to the site.
Getting this Uncaught (in promise) TypeError: Cannot read property 'apply' of undefined
error at line App.todoList = await App.contracts.TodoList.deployed()
.
I then tried upgrading the truffle-contract version but there's a new kind of error in the updated version as Invalid JSON RPC response
. Can you help me fix this?
I'm getting this error upon running the npm run dev command. Has anyone faced this same issue?
i am able to add and complete a task but while i am adding or deleting a task, it directly goes through and shows in my genache but the metamask extension doesn't pop up to confirm the transaction
I ran into an error like this.
Uncaught (in promise) Error: The send transactions "from" field must be defined!
at Object.createTask (app.js:98:28)
at HTMLFormElement.onsubmit ((index):53:74)
this is my createtask.
createTask: async () => {
App.setLoading(true)
const content = $('#newTask').val()
await App.todoList.createTask(content, {from: App.account})
window.location.reload()
},
index
<div class="container-fluid"> <div class="row"> <main role="main" class="d-flex col-lg-12 justify-content-center"> <div id="loader" class="text-center"> <p class="text-center">Loading...</p> </div> <div id="content"> <form onsubmit="App.createTask(); return false;"> <input type="text" class="form-control" id="newTask" placeholder="Add new task.." required> <input type="submit" hidden=""> </form> <ul id="taskList" class="list-unstyled"> <div id="taskTemplate" class="checkbox" style="display: none"> <label> <input type="checkbox"> <span class="content">Task content...</span> </label> </div> </ul> <ul id="completedTaskList" class="list-unstyled"> </ul> </div> </main> </div> </div>
help me
I suggest to update this project by adding a new branch, a lot of stuff not working
code:
loadContract: async ()=>{
//Create JS version of smart contract
const todoList = await $.getJSON('TodoList.json')
App.contracts.TodoList = TruffleContract(todoList)
App.contracts.TodoList = web3.setProvider(window.ethereum)
//getting values from blockchain
App.todoList = await App.contracts.TodoList.deployed()
console.log(App.todoList)
error:
TypeError: App.contracts.TodoList.deployed is not a function
did anyone run into this problem or does anyone know a fix/workaround?
Not sure why I'm getting this. I've tried installing the specific web3 and truffle-contract (as listed in the package.json file).
truffle-contract.js:29 Uncaught TypeError: (intermediate value).toBigNumber is not a function
at truffle-contract.js:29
at Object.<anonymous> (truffle-contract.js:962)
at Object.1../statuserror.js (truffle-contract.js:964)
at o (truffle-contract.js:1)
at truffle-contract.js:1
at Object.2../contract.js (truffle-contract.js:967)
at o (truffle-contract.js:1)
at r (truffle-contract.js:1)
at truffle-contract.js:1
Recently I completed the tutorial and saw there are lots of fixes to be done. Since it's more than 2 years and a lot has changed and deprecated (especially the meta mask wallet API).
So I have completed the project with new fixes here.
Hopefully, It will help if you are stuck anywhere!
After completing the task, when I toggle the task checkbox I am getting below error.
app.js:126 Uncaught (in promise) Error: The send transactions "from" field must be defined!
at HTMLInputElement.toggleCompleted (app.js:124:28)
at HTMLInputElement.dispatch (jquery.min.js:3:12444)
at HTMLInputElement.r.handle (jquery.min.js:3:9173)
Goodday, Web3 devs and learners, I am having this persistent issue for some days now. Each time i'm following up the tutorial on Intro To Ethereum programming [Full Course] at about 7hrs:14mins.
I tried running the app.js file by doing npm run dev. It runs smooth but returns this error on inspection
Uncaught (in promise) TypeError: Web3 is not a constructor
at Object.loadWeb3 (bundle.js:85130:20)
at Object.load (bundle.js:85122:19)
at bundle.js:85167:13
at dispatch (jquery.min.js:3:12444)
at r.handle (jquery.min.js:3:9173)
Note: The bundle.js is actually a browserified version of app.js, since require() doesn't apply smoothly to client-side JS, i had to create a browserified version of my original app.js file by running the command browserify app.js -o bundle.js
But, on clicking on the resulting error above, i noticed that the error is actually centered on any line with web3 as shown below
App = {
load: async () => {
await App.loadWeb3()
await App.loadAccount()
},
// https://medium.com/metamask/https-medium-com-metamask-breaking-change-
loadWeb3: async () => {
if (typeof web3 !== 'undefined') {
App.web3Provider = web3.currentProvider
web3 = new Web3(web3.currentProvider)
These errors were about 3 before now, but i've been able to debug the other 2, remaining this, and would appreciate a solution or input
//app.js
loadAccount: async ()=>{
App.account = web3.eth.accounts[0] // line no. 42
console.log(App.account)
}
//console
app.js:42 Uncaught (in promise) TypeError: Cannot read property 'accounts' of undefined
at Object.loadAccount (app.js:42)
at Object.load (app.js:9)
<form onSubmit="App.createTask(); return false;"> <input id="newTask" type="text" class="form-control" placeholder="Add task..." required> <input type="submit" hidden=""> </form>
I have an error "A 'return' statement can only be used within a function body." ın index.html code.
How can I fix it?
Hello,
you guys can find the updated working version of this project under
https://github.com/cagilceren/eth-todo-list
There are still couple of small bugs but it does not affect the functionality. I did not fix them yet since they are "at the moment" not so important for me, but i would appreciate if you would like to contribute :)
cant do it in windows stuck on npm install, getting error
unexpected tokken "$" ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.