我正在尝试使用Electron框架创建音频播放器。当我运行该应用程序时,在main.js中不存在的一行上收到“参数列表后缺少)错误。我该如何解决这个问题?
我到处都看过其他论坛的帖子,但总体而言我没有经验,欢迎提供帮助。
控制台日志:编辑:设法忘记添加其中的一部分。 :P
App threw an error during load
/Users/eddieb/Programming Projects/Electron/demoTesting/main.js:83
}.call(this, exports, require, module, __filename, __dirname); });
^
SyntaxError: missing ) after argument list
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:660:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:704:10)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at loadApplicationPackage (/Users/eddieb/Programming Projects/Electron/demoTesting/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js:119:12)
at Object.<anonymous> (/Users/eddieb/Programming Projects/Electron/demoTesting/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js:164:5)
JavaScript :(添加这些行之前,一切都很好。)
let content = "This is the content of the audio file";
dialog.showOpenDialog((fileNames) => {
// fileNames is an array that contains all the selected files.
if(fileNames === undefined){
console.log("No file selected");
return;
}
fs.readFile(filepath, 'utf-8', (err, data) => {
if(err){
alert("An error ocurred reading the file :" + err.message);
return;
}
// Change how to handle the file content.
console.log("The file content is : " + data);
});
});
我希望程序在添加文件加载功能的情况下启动,但是我在不存在的代码行中遇到错误。
答案 0 :(得分:0)
结果我输入了一些错误的论点。我需要添加“},false)”。