问题描述
我正在运行一个Electron项目,一切都很好.但是现在,当我运行package.json中的任何脚本(包括npm start)时,它只是转义了一行而没有执行任何操作.
I was running an Electron project, and everything worked just fine. But now when I run any of the scripts in my package.json (including npm start), it just escapes a line and doesn't do anything.
我的package.json:
My 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,但没有用.当我在其他项目中尝试过时,也行不通.
I tried updating NPM, didn't work. When I tried in different projects, also doesn't work.
预先感谢
推荐答案
npm具有ignore-scripts
配置密钥.它的期望值是布尔值,默认情况下设置为false
.
npm has a ignore-scripts
configuration key. It's expected value is a Boolean and it's set to false
by default.
可能是无意中将其设置为true
.
Perhaps it has inadvertently been set to true
.
对于get
/set
ignore-scripts
配置,您可以使用 npm-config 命令:
To get
/set
the ignore-scripts
configuration you can utilize the npm-config command:
-
通过运行以下命令检查其当前设置:
Check its current setting by running:
npm config get ignore-scripts
如果上述命令返回true
,请通过运行以下命令将其重置为false
:
If the aforementioned command returns true
then reset it to false
by running:
npm config set ignore-scripts false
这篇关于NPM运行*不执行任何操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!