node.jsnpm

error could not determine Node.js install directory


I have tried to install ionic by doing npm install ionic

ionic start myapp blank does not work and since then any npm commands tells me :

$ npm config
node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module 'C:\Users\dandonneau.m\devc\node_modules\npm\bin\npm-cli.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Could not determine Node.js install directory

Solution

  • I had the same error because I was using a too new version of Node for my system.

    Solution

    1. I solved the problem by downgrading the Node version to 15.8.0 (in my case via nvm, you can just re-install).
    2. You can also try upgrading your operating system.