Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM run * doesn't do anything

Tags:

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

like image 968
Filip Avatar asked Nov 24 '19 09:11

Filip


People also ask

Why npm run start is not working?

Check the ignore-script config If you see the start script is present inside your package. json file but still can't run the script, you need to check the console output. If there's no output at all, then you may have the ignore-scripts npm configuration set to true .

How do I force npm to run?

Run npm update -g npm. Execute this command by running the command prompt as Administrator npm install -g windows-build-tools. Run npm install inside the project folder where the package. json file is located, if it doesn't work run: npm install --force.

Why npm install is not working?

The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.

What does npm run actually do?

npm run sets the NODE environment variable to the node executable with which npm is executed. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install , just in case you've forgotten.


1 Answers

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 
like image 127
RobC Avatar answered Sep 20 '22 15:09

RobC