• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

260
Views
No "exports" main defined in C:\Users\node_modules\firebase\package.json

firebase config file.

here I am declaring my firebase configuration file, I am trying to initialize firebase firestore, database for one of my electron application, in the separate firebaseConfig.js file

const {initializeApp} = firebase;

const firebaseConfig = {
   setting all the configs here.. 

}

>here I am exporting the storage and db variables to be used in the main.js electron file where I have written a function to put the data to firebase

const storage = firebase.storage();
const db = firebase.firestore()
module.exports = storage;
module.exports = db;

main.js electron/node js file

below is the main.js file, where I am importing the variables that I have exported from the firebase config file

const storage = require('./firebase/firebaseconfig.js')
const db = require('./firebase/firebaseconfig.js');

function where firebase is being used, here I am supposed to use the storage and db variables that I have exported from the firebaseConfig file..

                    screenshot({format: 'png'})
                    .then((image)=>{
                        dns.lookup("www.google.com")
                        .then(()=>{
                           const uploadTask = storage.ref(`screenshots/${image.name}`).put(image);
                           uploadTask.on(
                               ()=>{
                                   storage
                                   .ref("screenshots")
                                   .child(image.name)
                                   .getDownloadURL()
                                   .then((url)=>{
                                    db.collection("screenshots").add({
                                        timestamp: firebase.firestore.FieldValue.serverTimestamp(),
                                        fieldName: image.name
                                    });
                                   })
                               } 
                           )
                        })
                        .catch(()=>{
                            fs.writeFile(path.join(myFolderPath, `new_screenshot_${counter}.png`),image, 
                            (err)=>{0
                                if(err){
                                    console.log(err)
                                }else{
                                    console.log('screenshot saved!');
                                    counter++;
                                }
                            });
                        })
                    })
                    .catch(err => console.log(err));
                }

now the problem is, with using firebase for node.js application.. I am being prompted with an error that states No "exports" main defined in C:\Users\screenshot_application\node_modules\firebase\package.json

about 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error