[英]Node.js RangeError: Maximum call stack size exceeded I dont get where my program get stuck in the loop?
Hello everyone I'm working on my udemy course and i have an issue when i compile with node.js solidity file with my compiler using windows terminal machine... this is the error I get:大家好,我正在学习我的udemy课程,当我使用windows终端机编译node.jssolidity文件时遇到问题......这是我得到的错误:
and to be clear ill show my solidity code and JavaScript so you guys have better view and would be nice if you can just explain me more what im doing wrong... sorry i may dont give as much info but i hope u guys do understand my problem.并且要清楚地显示我的可靠代码和 JavaScript 所以你们有更好的看法,如果你能解释一下我做错了什么会很好......对不起,我可能没有提供太多信息,但我希望你们能理解我的问题。
solidity and JavaScript code坚固性和 JavaScript 代码
compile.js file:编译.js 文件:
const path = require('path');
// fs = file system module
const fs = require('fs');
const solc = require('solc');
// give a path to a compiler the file you want to compile:
// "__dirname" means it will start the path from the files folder root in this project root folder is "Inbox"
const inboxPath = path.resolve(__dirname, 'contracts', 'Inbox.sol');
const source = fs.readFileSync(inboxPath, 'utf8');
console.log(solc.compile(source, 1));
and solidity.sol file和solidity.sol 文件
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.4.17;
contract Inbox{
string public message;
constructor(string initialMessage) public {
message = initialMessage;
}
function setMessage(string newMessage) public {
message = newMessage;
}
}
You need to pass a JSON-encoded options
object into the compile()
function - not just the source code (that's what your current code is doing).您需要将 JSON 编码的
options
object 传递到compile()
function - 而不仅仅是源代码(这就是您当前的代码正在执行的操作)。
You can find code example in the solc
package readme .您可以在
solc
package 自述文件中找到代码示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.