我正在运行一个Electron项目,一切都很好。但是现在,当我运行package.json中的任何脚本(包括npm start)时,它只是转义了一行而没有执行任何操作。
我的package.json:
{ "name": "interclip-desktop", "version": "0.0.7", "description": "Interclip for desktop", "repository": "https://github.com/aperta-principium/Interclip-desktop", "main": "main.js", "scripts": { "start": "electron .", "package-mac": "electron-packager . --overwrite --asar=true --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds", "package-win": "electron-packager . Interclip --overwrite --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Interclip\"", "package-linux": "electron-packager . Interclip --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds", "win-install": "node installers/windows/createinstaller.js", "postinstall": "electron-builder install-app-deps", "build": "electron-builder --linux", "release": "electron-builder --linux --publish always" }, "keywords": [ "Desktop", "Interclip" ], "author": "Filip Troníček", "license": "MIT", "devDependencies": { "electron": "^7.1.2", "electron-builder": "^22.1.0", "electron-installer-dmg": "^3.0.0", "electron-packager": "^14.1.1", "electron-reload": "^1.5.0", "electron-winstaller": "^4.0.0" }, "dependencies": { "axios": "^0.19.0", "mousetrap": "^1.6.3" }, "build": { "appId": "com.aperta-principium.interclip", "productName": "Interclip", "mac": { "category": "public.app-category.utilities" }, "dmg": { "icon": false }, "linux": { "target": [ "AppImage" ], "category": "Utility" } } }
我尝试更新NPM,但没有用。当我在其他项目中尝试过时,也不起作用。
提前致谢
npm具有ignore-scripts配置密钥。它的期望值是布尔值false,默认设置为。
ignore-scripts
false
可能是由于疏忽而将其设置为true。
true
要get/ set的ignore-scripts配置,你可以利用NPM- 配置命令:
get
set
通过运行以下命令检查其当前设置:
npm config get ignore-scripts
如果上述命令返回,true则false通过运行将其重置为:
npm config set ignore-scripts false