【发布时间】:2020-11-02 03:56:37
【问题描述】:
package.json:
{
"name": "password-generator",
"productName": "Password Generator",
"version": "1.0.0",
"description": "Password generator desktop app",
"main": "main.js",
"scripts": {
"start": "electron ."
"build-installer": "electron-builder"
},
"build": {
"appId": "password-generator",
},
"win": {
"target": ["nsis"],
"icon": "/icon.png",
},
"nsis": {
"installerIcon": "/icon.png",
"uninstallerIcon": "/icon.png",
"uninstallDisplayName": "Password Generator",
"oneClick": false,
"allowToChangeInstallationDirectory": true,
},
"author": "JipBit",
"license": "ISC",
"devDependencies": {
"electron-forge": "^5.2.4",
},
"dependencies": {
"electron-builder": "^22.7.0",
},
}
错误:
npm ERR! code EJSONPARSE
npm ERR! file C:\Users\mel\Desktop\Password Generator\package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 212 while parsing '{
npm ERR! JSON.parse "name": "password-generator",
npm ERR! JSON.parse "pro'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
信息: 尝试运行 npm start 和 npm run build-installer 时,我收到有关我的 package.json 文件的此错误。在设置运行 build-installer 以使我的电子应用程序成为可执行文件时添加到我的 package.json 后出现此错误。
编辑新错误:
'electron' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! password-generator@1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the password-generator@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
【问题讨论】:
标签: javascript node.js json npm electron