EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

Error: Cannot find module '.....nativescript-plugin-firebase/src/scripts/postinstall.js' #1855

Closed amidnikmal closed 2 years ago

amidnikmal commented 2 years ago

Hello there.

I faced the error below while trying out the demo from instructions.

...@...-N551JM:~/Desktop/.../mobile-apps/nativescript-plugin-firebase/src$ npm i

> @nativescript/firebase@11.1.3 postinstall
> node postinstall-hooks.js && node scripts/postinstall.js

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

Error: Cannot find module '/home/.../mobile-apps/nativescript-plugin-firebase/src/scripts/postinstall.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: []
}
npm ERR! code 1
npm ERR! path /home/.../Desktop/.../mobile-apps/nativescript-plugin-firebase/src
npm ERR! command failed
npm ERR! command sh -c node postinstall-hooks.js && node scripts/postinstall.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/.../.npm/_logs/2021-11-03T12_41_27_542Z-debug.log

What i'm doing is just steps from instruction image

Is file postinstall.js should be at nativescript-plugin-firebase/src/scripts ? How to fix that ? Which environment better to use to eventually run the demo ?

I use following environment:

OS: Ubuntu 20.04.2 LTS
node.js: v15.14.0
npm: 7.7.6
ns -v: 8.1.4

The reason why I started to investigate the demo apps is error for my own app:

TypeError: Cannot read property 'tasks' of undefined

There are threads where people also face same error ( first , second )

Also while trying to use nativescript-plugin-firebase i faced the same problem as here

And it could be fixed only if i do following ( from the issue 1716 ):

ns platform remove android
npm i @nativescript/firebase@11.1.0
ns debug android

Also in installation instruction there are folowing: image There was no launch screen while installing. Also file firebase.nativescript.json wasn't created. It seems like such behavior connected to absence of postinstall.js.

I suppose that there was something very important in postinstall.js. Could it be possible cause of issues such 1716, 1502, 1348 ?

amidnikmal commented 2 years ago

Migrating to node v12.22.7 resolve issue.