I try to connect my project with firebase and for that I run the command
firebase login
but it gives me the following error:
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'semver' Require stack:
C:\Users\ltomi\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\ltomi\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\ltomi\AppData\Roaming\npm\node_modules\firebase-tools \lib\bin\firebase.js' ] }
I fixed it by updating npm to the latest version available.