0

I have installed the react-clear-cache package and in the docs it says that I need to add a new script to my package.json.

This is my package.json scripts:

  "scripts": {
    "start": "node scripts/start.js",
    "build": "node scripts/build.js",
    "prebuild": "npm run generate-build-meta",
    "generate-build-meta": "./node_modules/react-clear-cache/bin/cli.js"
  },

According to the docs I need to run npm run generate-build-meta but everytime I try, node tells me that it wasnt able to find "./node_modules/react-clear-cache/bin/cli.js"

What I should do to correctly run this cli.js?

By the way, I have the react-clear-cache in my node_modules and I can see the cli.js

This is the message I receive: enter image description here

It is pretty much saying that '.' is not recognized as an internal command.

5
  • do you see that package in your node_modules directory? Commented Apr 16, 2021 at 20:52
  • Yes, I do @SamPetering Commented Apr 16, 2021 at 20:53
  • What is the exact error message? Please edit your question to include it exactly word for word rather than summarizing it. Better yet, google the error message. There's a good chance that someone else has already posted somewhere about that exact error. Commented Apr 16, 2021 at 20:56
  • @Code-Apprentice I'm posting here exactly bc I did not found an answer to my question. Commented Apr 16, 2021 at 21:02
  • try replacing the script with npm run react-clear-cache and running it then Commented Apr 16, 2021 at 21:13

1 Answer 1

2
  "scripts": {
    "start": "node scripts/start.js",
    "build": "node scripts/build.js",
    "prebuild": "npm run generate-build-meta",
    "generate-build-meta": "react-clear-cache"
  },

Accessing node_modules binaries by path is unnecessary in package.json scripts. Within the package.json, you can proceed as though node_modules/**/bin/ is in your $PATH.

Sign up to request clarification or add additional context in comments.

3 Comments

it says that 'react-clear-cache' is not recognized as an internal command
If I try reproducing this with a minimal package.json, I get the same error. This package may be doing things in a non-standard way. Attempting to run the file directly (npx react-clear-cache) gets me a similar error to this GitHub issue.
This is odd. I will try to create a git issue in this repo. Thanks anyway @backtick I will give you the correct answer since you had the effort to run it in your machine, thanks man.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.