NPM error message:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\nodejs\node_cache\_npx\13888" as it does not contain a package.json file.
Copy the code

Cause: The node path contains Spaces. Run NPM config get cache to obtain D: Program Files\nodejs\node_modules\ NPM \node_cache

Solution: Rewrite the path

  • performnpm config editModify the.npmrcD:\Program~1\nodejs\node_modules\ NPM \node_cache (this is a path expression for Windows)
  • performnpm config set cache "D:\Program~1\nodejs\node_modules\npm\node_cache"--global