Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] "npm run" appears not to work #541

Closed
snerks opened this issue Dec 1, 2019 · 8 comments
Closed

[BUG] "npm run" appears not to work #541

snerks opened this issue Dec 1, 2019 · 8 comments

Comments

@snerks
Copy link

snerks commented Dec 1, 2019

What / Why

"npm run" appears not to work - generates no output.

When

On a command line (Windows "CMD.EXE")

Where

Windows Home (Version 1909)
node -v: v12.13.1
npm -v: 6.12.1

How

Current Behavior

npm run generates no output

Steps to Reproduce

On a command line (Windows "CMD.EXE"):
md npm-run-issue
cd npm-run-issue
npm init

Edit contents of package.json:

{
  "name": "npm-run-issue",
  "version": "1.0.0",
  "description": "Minimal reproduction of npm run issue",
  "main": "index.js",
  "scripts": {
    "echo": "echo 'run' works!"
  },
  "author": "",
  "license": "ISC"
}

npm run echo

No output (at all) is generated.

Expected Behavior

Output should be similar to that from "yarn run":
yarn run v1.9.4
$ echo 'run' works!
'run' works!
Done in 0.12s.

References

The issue can be reproduced locally with this GitHub repository:
https://github.com/snerks/npm-run-issue

@ljharb
Copy link
Contributor

ljharb commented Dec 1, 2019

Do you have “ignore-scripts” set in your global npm config?

@snerks
Copy link
Author

snerks commented Dec 2, 2019

@ljharb

I just checked the global config folder:
C:\Users\[UserName]\AppData\Roaming\npm\etc\npmrc

In my case, no such folder existed.

I then checked the per-user config file:
C:\Users\[UserName]\.npmrc

To my surprise, the file contained this (as you suspected):
ignore-scripts=true

I set it to this:
ignore-scripts=false

Then retried:
npm run echo:

> [email protected] echo C:\D\SamplesNode\npm-run-issue
> echo 'run' works!

'run' works!

Question: Any idea how this setting gets made? I'm pretty sure I didn't do it (as far as I know).

@ljharb
Copy link
Contributor

ljharb commented Dec 2, 2019

You probably followed some paranoid tutorial that suggested disabling that setting systemwide with npm config -g ignore-scripts false or something.

@jeffminsungkim
Copy link

jeffminsungkim commented Dec 2, 2019

I'm having the same issue.
npm install neither upgrade nor downgrade the package works.
npm install package {package-name}@{version} works.

@ljharb
Copy link
Contributor

ljharb commented Dec 2, 2019

@jeffminsungkim thats a different issue, i think.

@snerks
Copy link
Author

snerks commented Dec 2, 2019

@ljharb - thanks for resolving my issue!

@snerks snerks closed this as completed Dec 2, 2019
@JohnnyTMD
Copy link

@ljharb thanks for the solution
For linux users>
~/.npmrc open that file and set ignore-scripts=false

@dennismbugua
Copy link

installing npm install --save-dev nodemon and running npm start did the magic for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants