angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Cannot find module 'firebase/app'.

Open raidel-dev opened this issue 8 years ago • 12 comments

Version info

"@angular/animations": "5.2.0", "@angular/common": "5.2.0", "@angular/compiler": "5.2.0", "@angular/core": "5.2.0", "@angular/forms": "5.2.0", "@angular/http": "5.2.0", "@angular/platform-browser": "5.2.0", "@angular/platform-browser-dynamic": "5.2.0", "@angular/router": "5.2.0", "angularfire2": "^5.1.0",

Actual behavior

ERROR in node_modules/@angular/fire/firebase.app.module.d.ts(2,79): error TS2307: Cannot find module 'firebase/app'.

raidel-dev avatar Nov 13 '18 16:11 raidel-dev

Hi, I'm having the same issue deploying the Library in an Ionic 4 app :

Version info

"@angular/common": "~6.1.1",
"@angular/core": "~6.1.1",
"@angular/fire": "^5.1.0",
"@angular/forms": "~6.1.1",
"@angular/http": "~6.1.1",
"@angular/platform-browser": "~6.1.1",
"@angular/platform-browser-dynamic": "~6.1.1",
"@angular/router": "~6.1.1",
"@ionic-native/core": "5.0.0-beta.21",
"@ionic-native/splash-screen": "5.0.0-beta.21",
"@ionic-native/status-bar": "5.0.0-beta.21",
"@ionic/angular": "4.0.0-beta.15",
"core-js": "^2.5.3",
"firebase": "^5.5.8",
"rxjs": "6.2.2",
"zone.js": "^0.8.26"

Actual behavior ERROR in node_modules/@angular/fire/firebase.app.module.d.ts(2,79): error TS2307: Cannot find module 'firebase/app'.

sercada avatar Nov 14 '18 20:11 sercada

+1

georgelviv avatar Nov 14 '18 23:11 georgelviv

Temporary fix. revert to version npm i --save [email protected] @angular/[email protected]

georgelviv avatar Nov 15 '18 10:11 georgelviv

Well, I've found that I was using Node.JS Latest version (11.1.0). I just changed the environment to Node LTS version and it works like charm.

No need to revert to previous versions of @angular/fire

sercada avatar Nov 15 '18 11:11 sercada

npm i firebase

bonusskate avatar Mar 15 '19 04:03 bonusskate

npm i firebase

This worked for my because i forgot to install firebase. I only installed the angularfire wrapper.

Thanks!

emidev98 avatar Apr 23 '19 13:04 emidev98

Hi. I'm following the steps of webpage https://github.com/angular/angularfire2/blob/HEAD/docs/install-and-setup.md , however, once I finish the step 5, I run the angular app and it give me this error. "ERROR in node_modules/@angular/fire/firebase.app.module.d.ts(2,79): error TS2307: Cannot find module 'firebase'."

At the end of this message I left all console output, from creation of the project to the fail compilation.

I need some help with this problem, I'm sure that it is about version, but I cannot resolve for myself.

Thank you in advance.

` C:\Users\Emilio\source\repos>ng new githubtest ? Would you like to add Angular routing? Yes ? Which stylesheet format would you like to use? CSS CREATE githubtest/angular.json (3843 bytes) CREATE githubtest/package.json (1309 bytes) CREATE githubtest/README.md (1027 bytes) CREATE githubtest/tsconfig.json (435 bytes) CREATE githubtest/tslint.json (1621 bytes) CREATE githubtest/.editorconfig (246 bytes) CREATE githubtest/.gitignore (629 bytes) CREATE githubtest/src/favicon.ico (5430 bytes) CREATE githubtest/src/index.html (297 bytes) CREATE githubtest/src/main.ts (372 bytes) CREATE githubtest/src/polyfills.ts (2841 bytes) CREATE githubtest/src/styles.css (80 bytes) CREATE githubtest/src/test.ts (642 bytes) CREATE githubtest/src/browserslist (388 bytes) CREATE githubtest/src/karma.conf.js (1023 bytes) CREATE githubtest/src/tsconfig.app.json (166 bytes) CREATE githubtest/src/tsconfig.spec.json (256 bytes) CREATE githubtest/src/tslint.json (244 bytes) CREATE githubtest/src/assets/.gitkeep (0 bytes) CREATE githubtest/src/environments/environment.prod.ts (51 bytes) CREATE githubtest/src/environments/environment.ts (662 bytes) CREATE githubtest/src/app/app-routing.module.ts (245 bytes) CREATE githubtest/src/app/app.module.ts (393 bytes) CREATE githubtest/src/app/app.component.html (1152 bytes) CREATE githubtest/src/app/app.component.spec.ts (1107 bytes) CREATE githubtest/src/app/app.component.ts (214 bytes) CREATE githubtest/src/app/app.component.css (0 bytes) CREATE githubtest/e2e/protractor.conf.js (752 bytes) CREATE githubtest/e2e/tsconfig.e2e.json (213 bytes) CREATE githubtest/e2e/src/app.e2e-spec.ts (639 bytes) CREATE githubtest/e2e/src/app.po.ts (251 bytes)

[email protected] install C:\Users\Emilio\source\repos\githubtest\node_modules\node-sass node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location try setting a proxy via HTTP_PROXY, e.g.

  export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

  npm config set proxy http://example.com:8080

[email protected] postinstall C:\Users\Emilio\source\repos\githubtest\node_modules\node-sass node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\Users\Emilio\source\repos\githubtest\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli 'C:\Program Files\nodejs\node.exe', gyp verb cli 'C:\Users\Emilio\source\repos\githubtest\node_modules\node-gyp\bin\node-gyp.js', gyp verb cli 'rebuild', gyp verb cli '--verbose', gyp verb cli '--libsass_ext=', gyp verb cli '--libsass_cflags=', gyp verb cli '--libsass_ldflags=', gyp verb cli '--libsass_library=' gyp verb cli ] gyp info using [email protected] gyp info using [email protected] | win32 | x64 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing "build" directory gyp verb command configure [] gyp verb check python checking for Python executable "python2" in the PATH gyp verb which failed Error: not found: python2 gyp verb which failed at getNotFoundError (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:80:29) gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:89:16 gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\index.js:42:5 gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\windows.js:36:5 gyp verb which failed at FSReqCallback.oncomplete (fs.js:166:21) gyp verb which failed python2 Error: not found: python2 gyp verb which failed at getNotFoundError (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:80:29) gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:89:16 gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\index.js:42:5 gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\windows.js:36:5 gyp verb which failed at FSReqCallback.oncomplete (fs.js:166:21) { gyp verb which failed stack: 'Error: not found: python2\n at getNotFoundError ' + gyp verb which failed '(C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:13:12)\n' + gyp verb which failed ' at F ' + gyp verb which failed '(C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:68:19)\n' + gyp verb which failed ' at E ' + gyp verb which failed '(C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:80:29)\n' + gyp verb which failed ' at ' + gyp verb which failed 'C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:89:16\n ' + gyp verb which failed ' at ' + gyp verb which failed 'C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\index.js:42:5\n ' + gyp verb which failed ' at ' + gyp verb which failed 'C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\windows.js:36:5\n' + gyp verb which failed ' at FSReqCallback.oncomplete (fs.js:166:21)', gyp verb which failed code: 'ENOENT' gyp verb which failed } gyp verb check python checking for Python executable "python" in the PATH gyp verb which failed Error: not found: python gyp verb which failed at getNotFoundError (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:80:29) gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:89:16 gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\index.js:42:5 gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\windows.js:36:5 gyp verb which failed at FSReqCallback.oncomplete (fs.js:166:21) gyp verb which failed python Error: not found: python gyp verb which failed at getNotFoundError (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:80:29) gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:89:16 gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\index.js:42:5 gyp verb which failed at C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\windows.js:36:5 gyp verb which failed at FSReqCallback.oncomplete (fs.js:166:21) { gyp verb which failed stack: 'Error: not found: python\n at getNotFoundError ' + gyp verb which failed '(C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:13:12)\n' + gyp verb which failed ' at F ' + gyp verb which failed '(C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:68:19)\n' + gyp verb which failed ' at E ' + gyp verb which failed '(C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:80:29)\n' + gyp verb which failed ' at ' + gyp verb which failed 'C:\Users\Emilio\source\repos\githubtest\node_modules\which\which.js:89:16\n' + gyp verb which failed ' at ' + gyp verb which failed 'C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\index.js:42:5\n ' + gyp verb which failed ' at ' + gyp verb which failed 'C:\Users\Emilio\source\repos\githubtest\node_modules\isexe\windows.js:36:5\n' + gyp verb which failed ' at FSReqCallback.oncomplete (fs.js:166:21)', gyp verb which failed code: 'ENOENT' gyp verb which failed } gyp verb could not find "python". checking python launcher gyp verb could not find "python". guessing location gyp verb ensuring that file exists: C:\Python27\python.exe gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\Users\Emilio\source\repos\githubtest\node_modules\node-gyp\lib\configure.js:484:19) gyp ERR! stack at PythonFinder. (C:\Users\Emilio\source\repos\githubtest\node_modules\node-gyp\lib\configure.js:509:16) gyp ERR! stack at C:\Users\Emilio\source\repos\githubtest\node_modules\graceful-fs\polyfills.js:282:31 gyp ERR! stack at FSReqCallback.oncomplete (fs.js:166:21) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Emilio\source\repos\githubtest\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd C:\Users\Emilio\source\repos\githubtest\node_modules\node-sass gyp ERR! node -v v12.0.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok Build failed with error code: 1 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\node-sass): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] postinstall: node scripts/build.js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 1025 packages from 1012 contributors and audited 42611 packages in 132.682s found 1 high severity vulnerability run npm audit fix to fix them, or npm audit for details "git" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable.

C:\Users\Emilio\source\repos>cd githubtest

C:\Users\Emilio\source\repos\githubtest>ng serve -o ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2019-05-07T15:04:16.919Z Hash: 6f7c642dacdb934c6fc8 Time: 6478ms chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 284 kB [initial] [rendered] chunk {main} main.js, main.js.map (main) 11.6 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 236 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 16.3 kB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 3.77 MB [initial] [rendered] i 「wdm」: Compiled successfully. ^C¿Desea terminar el trabajo por lotes (S/N)? ^C C:\Users\Emilio\source\repos\githubtest>npm install @angular/fire firebase --save

[email protected] install C:\Users\Emilio\source\repos\githubtest\node_modules\grpc node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v72-win32-x64-unknown.tar.gz node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, unknown) (falling back to source compile with node-gyp) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19) gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:282:31 gyp ERR! stack at FSReqCallback.oncomplete (fs.js:166:21) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=C:\Users\Emilio\source\repos\githubtest\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\Users\Emilio\source\repos\githubtest\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72" gyp ERR! cwd C:\Users\Emilio\source\repos\githubtest\node_modules\grpc gyp ERR! node -v v12.0.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\Emilio\source\repos\githubtest\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\Emilio\source\repos\githubtest\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1) node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Emilio\source\repos\githubtest\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:196:13) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1000:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5) node-pre-gyp ERR! System Windows_NT 10.0.17134 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Emilio\source\repos\githubtest\node_modules\grpc\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library" node-pre-gyp ERR! cwd C:\Users\Emilio\source\repos\githubtest\node_modules\grpc node-pre-gyp ERR! node -v v12.0.0 node-pre-gyp ERR! node-pre-gyp -v v0.12.0 node-pre-gyp ERR! not ok Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\Users\Emilio\source\repos\githubtest\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\Emilio\source\repos\githubtest\node_modules\grpc\src\node\extension_binary\node-v72-win32-x64-unknown --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Emilio\AppData\Roaming\npm-cache_logs\2019-05-07T15_05_38_454Z-debug.log

C:\Users\Emilio\source\repos\githubtest>ng serve -o ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2019-05-07T15:11:45.613Z Hash: 6f7c642dacdb934c6fc8 Time: 6133ms chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 284 kB [initial] [rendered] chunk {main} main.js, main.js.map (main) 11.6 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 236 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 16.3 kB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 3.77 MB [initial] [rendered] i 「wdm」: Compiled successfully. ^C¿Desea terminar el trabajo por lotes (S/N)? ^C C:\Users\Emilio\source\repos\githubtest>ng serve -o ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2019-05-07T15:19:55.673Z Hash: 540b11b74394a7fb032c Time: 5094ms chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 284 kB [initial] [rendered] chunk {main} main.js, main.js.map (main) 1.93 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 93.1 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 16.3 kB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 327 kB [initial] [rendered]

ERROR in node_modules/@angular/fire/firebase.app.module.d.ts(2,74): error TS2307: Cannot find module 'firebase/app'.

i 「wdm」: Failed to compile.

`

lcdiaz87 avatar May 07 '19 15:05 lcdiaz87

ERROR in node_modules/angularfire2/node_modules/@angular/fire/auth/auth.d.ts(4,28): error TS2307: Cannot find module 'firebase/app'. ??

fsalican avatar Dec 18 '19 13:12 fsalican

npm i firebase

is there any solution? I am also facing the same issue, even after trying this issue is not resolved

ERROR in node_modules/@angular/fire/database/interfaces.d.ts(2,26): error TS2307: Cannot find module 'firebase/app'. node_modules/@angular/fire/firebase.app.module.d.ts(2,74): error TS2307: Cannot find module 'firebase/app'. node_modules/@angular/fire/storage/interfaces.d.ts(1,25): error TS2307: Cannot find module 'firebase/app'. node_modules/@angular/fire/storage/observable/fromTask.d.ts(3,25): error TS2307: Cannot find module 'firebase/app'.

chetlrohith97 avatar Mar 16 '20 08:03 chetlrohith97

Any solution here? I am using Angular 7.

BenJohnThird avatar Apr 14 '20 12:04 BenJohnThird

Any solution here? I am using Angular 7.

Have you tried doing npm i firebase as mentioned by @bonusskate?

mehdiali17 avatar Jun 16 '20 06:06 mehdiali17

Have you tried add ../ ahead of the file path? If you know the file exists it is a path issue. Try typing the path code so that it looks like this example after the class is imported: '../../services/firebase.service';

babcodes avatar Nov 11 '20 14:11 babcodes