[FIXED] Cannot find module core-js while installing firebase-tools with npm

Issue

I’m trying to install firebase with npm to have a global access to its commands, but every time I try to run npm install -g firebase-tools I get this:

> npm install -g firebase-tools
C:\Users\dabek\.cache\firebase\tools\firebase -> C:\Users\dabek\.cache\firebase\tools\node_modules\firebase-tools\lib\bin\firebase.js

> core-js@3.6.5 postinstall C:\Users\#user name#\.cache\firebase\tools\node_modules\firebase-tools\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'C:\Users\#user name#\CACHE~1\firebase\tools\NODE_M~1\FIREBA~1\NODE_M~1\core-js\-e'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function._resolveFilename (pkg/prelude/bootstrap.js:1955:46)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.runMain (pkg/prelude/bootstrap.js:1983:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\firebase-tools\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-js@3.6.5 (node_modules\firebase-tools\node_modules\core-js):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-js@3.6.5 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ firebase-tools@11.4.2
added 14 packages from 7 contributors and updated 1 package in 19.174s

(user name hidden only here for privacy reasons of course)

I’m running the command in the shell from the Firebase CLI binary from https://firebase.google.com/docs/cli#windows-standalone-binary (yes, I’m using Windows).

Any ideas? :/

Solution

  1. Try to install from the regular windows cmd as administrator.
  2. Try to downgrade your node version to 14.18.0.

Answered By – Daniil8k

Answer Checked By – Laura B. (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published