NPM run * doesn't do anything
Asked Answered
B

2

28

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.

command line screenshot

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"
    }
  }
}

I tried updating NPM, didn't work. When I tried in different projects, also doesn't work.

Thanks in advance

Barbitone answered 24/11, 2019 at 9:33 Comment(0)
U
61

npm has a ignore-scripts configuration key. It's expected value is a Boolean and it's set to false by default.

Perhaps it has inadvertently been set to true.

To get/set the ignore-scripts configuration you can utilize the npm-config command:

  1. Check its current setting by running:

    npm config get ignore-scripts
    
  2. If the aforementioned command returns true then reset it to false by running:

    npm config set ignore-scripts false
    
Undis answered 24/11, 2019 at 13:17 Comment(4)
Setting ignore-scripts to false is not secure actuallyCannonball
npm config get ignore-scripts and npm --help don't work for me, npm runs and returns nothing instantly.Blunk
Life-saving answer, @RobC. Thank you. I only have a passing familiarity with npm and I would never have figured this out on my own. 200 rep bounty coming your way.Boony
npm config get ignore-scripts doesn't return nothing in the terminal, it's empty line againFavors
B
2

If you are using an integrated terminal (such as the VsCode integrated terminal) try running your npm "run dev' command from your PowerShell (or cmd) terminal. This error arises as a result of your integrated terminal not recognizing your command (especially if you created your app with a git bash terminal).

Try this, and I hope it helps someone cause it always works for me. Cheers!!!

Bowhead answered 7/4, 2020 at 21:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.