1

I started a firebase project with the following folder structure:

.firebase
functions/
   node_modules/
   .eslintrc.json
   index.js
   package-lock.json
   package.json
public/
   index.html
.firebaserc
.gitignore
firebase.json

Since I want to integrate VueJS to it, I moved node_modules/, package-lock.json, package.json and eslintrc.json to the ROOT folder.

After I did that I had to add the following to the functions attribute in firebase.json: "source": "functions"

When I run firebase serve everything works great. However, when I try to firebase deploy an error message raises:

Error: No npm package found in functions source directory. Please run 'npm init' inside functions

How is the best way to organize my project to properly integrate Functions and Vue?

Please do not tell me that I should have two package.json

  • 2
    What's wrong with two package.json? I can't imagine that you'd want to mix up your frontend and backend modules into a single module with a single package.json. – Doug Stevenson Mar 12 at 0:37
  • @DougStevenson, probably I didn't want it because I come from a RoR world, where projects have a single Gemfile for Frontend and Backend. I clarified concepts by reading docs.npmjs.com/about-packages-and-modules. If somebody has a folder structure suggestion for this particular integration, it is welcomed. – leanGuardia Mar 12 at 13:52
  • Yeah, that's not the way it works. Maybe pick another framework that does what you're suggesting. – Doug Stevenson Mar 12 at 16:05
  • Thank you for your suggestion, however, I'm sticking with Vue, using its default folder structure and adding a functions folder – leanGuardia Mar 18 at 19:43

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.