question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module 'semver'

See original GitHub issue

[REQUIRED] Environment info

firebase-tools:

> firebase --version
pkg/prelude/bootstrap.js:1244
      throw error;
      ^

Error: Cannot find module 'semver'
Require stack:
-...\firebase\tools\lib\node_modules\firebase-tools\lib\bin\firebase.js
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1346:46)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at Module.require (pkg/prelude/bootstrap.js:1225:31)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (...\firebase\tools\lib\node_modules\firebase-tools\lib\bin\firebase.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Module._compile (pkg/prelude/bootstrap.js:1281:32)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '...\\firebase\\tools\\lib\\node_modules\\firebase-tools\\lib\\bin\\firebase.js'
  ],
  pkg: true
}

Platform: Windows 10 19041.264

[REQUIRED] Test case

See above

[REQUIRED] Steps to reproduce

firebase --version firebase login firebase init firebase anything

[REQUIRED] Expected behavior

I believe it opens a new browser window for me to login with.

[REQUIRED] Actual behavior

It fails to do anything at all.

> firebase login --debug
pkg/prelude/bootstrap.js:1244
      throw error;
      ^

Error: Cannot find module 'semver'
Require stack:
- ...\firebase\tools\lib\node_modules\firebase-tools\lib\bin\firebase.js
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1346:46)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at Module.require (pkg/prelude/bootstrap.js:1225:31)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (...\firebase\tools\lib\node_modules\firebase-tools\lib\bin\firebase.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Module._compile (pkg/prelude/bootstrap.js:1281:32)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '...\\firebase\\tools\\lib\\node_modules\\firebase-tools\\lib\\bin\\firebase.js'
  ],
  pkg: true
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
bandwichescommented, Jun 5, 2020

Fixed.

Error: Cannot find module 'semver'
Require stack:
- ...\firebase\tools\lib\node_modules\firebase-tools\lib\bin\firebase.js

Delete the folder referenced (above) and re-run firebase (below)

> firebase login

It will take a while to rebuild the directory, but let it go and it will work.

1reaction
lucasbarrosomk6commented, Apr 26, 2022

Fixed.

Error: Cannot find module 'semver'
Require stack:
- ...\firebase\tools\lib\node_modules\firebase-tools\lib\bin\firebase.js

Delete the folder referenced (above) and re-run firebase (below)

> firebase login

It will take a while to rebuild the directory, but let it go and it will work.

I am having a similar issue whenever I run firebase commands. you say “delete the folder referenced (above)” but you mention a file. What folder needs to be deleted?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Npm install cannot find module 'semver' - Stack Overflow
Solution:Delete the npm-cache/npm folder in the installation directory of nodejs. In windows, it is in C:/User/Username/Appdata/Roaming/npm(or npm_cache). and ...
Read more >
Npm can't find module "semver" error in Ubuntu 19.04
It asked me to run command 'npm ci' from which I started getting this error. I tried reinstalling npm but it won't work....
Read more >
Fix - Cannot find module 'semver' error in Node.js - Reactgo
The Cannot find module 'semver' error occurs if you're trying to run an npm install command in your project. To solve the error...
Read more >
Fix for Cannot Find Module 'Semver' on Ubuntu 20.04 #125
Fix for Cannot Find Module 'Semver' on Ubuntu 20.04 I was unable to run npm run setup --silent and npm run dev until...
Read more >
JavaScript : Npm install cannot find module 'semver' - YouTube
JavaScript : Npm install cannot find module ' semver ' [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] JavaScript : Npm install ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found