npm solc: AssertionError [ERR_ASSERTION]: Invalid callback specified
I am trying to compile solidity smart contract using npm solc. I tried to follow different examples.
Link to example: https://medium.com/coinmonks/how-to-compile-a-solidity-smart-contract-using-node-js-51ea7c6bf440
I wrote my code like following:
const path = require('path');
const fs = require('fs');
const solc = require('solc');
const helloPath = path.resolve(__dirname, 'contracts', 'hello.sol');
console.log("First" + helloPath);
const source = fs.readFileSync(helloPath, 'UTF-8');
console.log("Second" + source);
console.log(solc.compile(source, 1));
I am getting following error when running the above code.
AssertionError [ERR_ASSERTION]: Invalid callback specified.
at wrapCallback (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:16:5)
at runWithReadCallback (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:37:42)
at compileStandard (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:78:14)
at Object.compileStandardWrapper (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:85:14)
at Object.<anonymous> (C:Usersmouazzamj058solc_exampleexample.js:4:19)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Please help.
node.js npm ethereum solidity
add a comment |
I am trying to compile solidity smart contract using npm solc. I tried to follow different examples.
Link to example: https://medium.com/coinmonks/how-to-compile-a-solidity-smart-contract-using-node-js-51ea7c6bf440
I wrote my code like following:
const path = require('path');
const fs = require('fs');
const solc = require('solc');
const helloPath = path.resolve(__dirname, 'contracts', 'hello.sol');
console.log("First" + helloPath);
const source = fs.readFileSync(helloPath, 'UTF-8');
console.log("Second" + source);
console.log(solc.compile(source, 1));
I am getting following error when running the above code.
AssertionError [ERR_ASSERTION]: Invalid callback specified.
at wrapCallback (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:16:5)
at runWithReadCallback (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:37:42)
at compileStandard (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:78:14)
at Object.compileStandardWrapper (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:85:14)
at Object.<anonymous> (C:Usersmouazzamj058solc_exampleexample.js:4:19)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Please help.
node.js npm ethereum solidity
Are you sure this error is fromsolc
. Can you debug and see where exactly you get the error from?
– nikos fotiadis
Nov 17 '18 at 20:28
There was a bug I guess. Installing solc@0.4.25 worked.
– Mouazzam
Nov 19 '18 at 11:08
add a comment |
I am trying to compile solidity smart contract using npm solc. I tried to follow different examples.
Link to example: https://medium.com/coinmonks/how-to-compile-a-solidity-smart-contract-using-node-js-51ea7c6bf440
I wrote my code like following:
const path = require('path');
const fs = require('fs');
const solc = require('solc');
const helloPath = path.resolve(__dirname, 'contracts', 'hello.sol');
console.log("First" + helloPath);
const source = fs.readFileSync(helloPath, 'UTF-8');
console.log("Second" + source);
console.log(solc.compile(source, 1));
I am getting following error when running the above code.
AssertionError [ERR_ASSERTION]: Invalid callback specified.
at wrapCallback (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:16:5)
at runWithReadCallback (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:37:42)
at compileStandard (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:78:14)
at Object.compileStandardWrapper (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:85:14)
at Object.<anonymous> (C:Usersmouazzamj058solc_exampleexample.js:4:19)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Please help.
node.js npm ethereum solidity
I am trying to compile solidity smart contract using npm solc. I tried to follow different examples.
Link to example: https://medium.com/coinmonks/how-to-compile-a-solidity-smart-contract-using-node-js-51ea7c6bf440
I wrote my code like following:
const path = require('path');
const fs = require('fs');
const solc = require('solc');
const helloPath = path.resolve(__dirname, 'contracts', 'hello.sol');
console.log("First" + helloPath);
const source = fs.readFileSync(helloPath, 'UTF-8');
console.log("Second" + source);
console.log(solc.compile(source, 1));
I am getting following error when running the above code.
AssertionError [ERR_ASSERTION]: Invalid callback specified.
at wrapCallback (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:16:5)
at runWithReadCallback (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:37:42)
at compileStandard (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:78:14)
at Object.compileStandardWrapper (C:Usersmouazzamj058solc_examplenode_modulessolcwrapper.js:85:14)
at Object.<anonymous> (C:Usersmouazzamj058solc_exampleexample.js:4:19)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Please help.
node.js npm ethereum solidity
node.js npm ethereum solidity
asked Nov 17 '18 at 16:29
Mouazzam
789
789
Are you sure this error is fromsolc
. Can you debug and see where exactly you get the error from?
– nikos fotiadis
Nov 17 '18 at 20:28
There was a bug I guess. Installing solc@0.4.25 worked.
– Mouazzam
Nov 19 '18 at 11:08
add a comment |
Are you sure this error is fromsolc
. Can you debug and see where exactly you get the error from?
– nikos fotiadis
Nov 17 '18 at 20:28
There was a bug I guess. Installing solc@0.4.25 worked.
– Mouazzam
Nov 19 '18 at 11:08
Are you sure this error is from
solc
. Can you debug and see where exactly you get the error from?– nikos fotiadis
Nov 17 '18 at 20:28
Are you sure this error is from
solc
. Can you debug and see where exactly you get the error from?– nikos fotiadis
Nov 17 '18 at 20:28
There was a bug I guess. Installing solc@0.4.25 worked.
– Mouazzam
Nov 19 '18 at 11:08
There was a bug I guess. Installing solc@0.4.25 worked.
– Mouazzam
Nov 19 '18 at 11:08
add a comment |
1 Answer
1
active
oldest
votes
Which version of solc are you using?
Solc released a breaking version the other day, this error is related to that.
npm uninstall solc
npm install solc@0.4.25
1
It worked. Thanks!!
– Mouazzam
Nov 19 '18 at 11:07
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353167%2fnpm-solc-assertionerror-err-assertion-invalid-callback-specified%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Which version of solc are you using?
Solc released a breaking version the other day, this error is related to that.
npm uninstall solc
npm install solc@0.4.25
1
It worked. Thanks!!
– Mouazzam
Nov 19 '18 at 11:07
add a comment |
Which version of solc are you using?
Solc released a breaking version the other day, this error is related to that.
npm uninstall solc
npm install solc@0.4.25
1
It worked. Thanks!!
– Mouazzam
Nov 19 '18 at 11:07
add a comment |
Which version of solc are you using?
Solc released a breaking version the other day, this error is related to that.
npm uninstall solc
npm install solc@0.4.25
Which version of solc are you using?
Solc released a breaking version the other day, this error is related to that.
npm uninstall solc
npm install solc@0.4.25
answered Nov 17 '18 at 17:36
Falko
1285
1285
1
It worked. Thanks!!
– Mouazzam
Nov 19 '18 at 11:07
add a comment |
1
It worked. Thanks!!
– Mouazzam
Nov 19 '18 at 11:07
1
1
It worked. Thanks!!
– Mouazzam
Nov 19 '18 at 11:07
It worked. Thanks!!
– Mouazzam
Nov 19 '18 at 11:07
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53353167%2fnpm-solc-assertionerror-err-assertion-invalid-callback-specified%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you sure this error is from
solc
. Can you debug and see where exactly you get the error from?– nikos fotiadis
Nov 17 '18 at 20:28
There was a bug I guess. Installing solc@0.4.25 worked.
– Mouazzam
Nov 19 '18 at 11:08