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.

firebase deploy --only functions without node_modules

See original GitHub issue

From the docs I concluded that it’s not necessary to have local pckgs in node_modules installed for GCS to operate: it should install them in the instance based on package.json. So, I deleted node_modules coz it seemed that it uploads and takes some time to do that. However I get an err. Anyone else has this?

i  deploying functions
i  functions: ensuring necessary APIs are enabled...
i  runtimeconfig: ensuring necessary APIs are enabled...
+  runtimeconfig: all necessary APIs are enabled
+  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...

Error: Error parsing triggers: Cannot find module 'firebase-functions'

Try running "npm install" in your functions directory before deploying.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

27reactions
laurenzlongcommented, Jun 9, 2017

Hi @jjhesk , run the following inside of your functions directory:

npm install
firebase deploy 
12reactions
ralphsmith80commented, Jun 21, 2017

I ran into this and struggled with it for a bit so just to add some help to others that might run across this and not see the obvious answer.

If you’re using some kind of automated pipeline then you will likely need to specifically add the cd functions && npm install && cd - to the runner. Below is an example .gitlab-ci.yml that I use for for a gitlab polymer project.

I think I got hung up on this because I didn’t have to do that step locally when I first setup the project. Likely firebase init just did it for me.

image: node:6

before_script:
  - npm install -g firebase-tools
  - npm install -g bower
  - npm install -g polymer-cli

cache:
  paths:
    - node_modules/
    - functions/node_modules/
    - bower_components/

deploy_to_firebase:
  stage: deploy
  environment: Production
  only:
    - master
  script:
    # cd to the functions directory and `npm install` so firebase-functions is installed
    - cd functions && npm install && cd -
    - bower install --allow-root
    - polymer build
    - firebase use --token $FIREBASE_DEPLOY_KEY
    - firebase deploy -m "Pipeline $CI_PIPELINE_ID, build $CI_BUILD_ID" --non-interactive --token $FIREBASE_DEPLOY_KEY
Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage functions | Cloud Functions for Firebase - Google
Deploy functions. To deploy functions, run this Firebase CLI command: firebase deploy --only ...
Read more >
How to deploy some functions to Cloud Functions for Firebase ...
There is currently no way to deploy a single function with the Firebase CLI. Running `firebase deploy` will deploy all functions. We've recently ......
Read more >
When Your Firebase Cloud Functions Don't Want to Deploy ...
Why were the build error details not available? I'll never… ... You have 2 free member-only stories left this month. ... firebase deploy...
Read more >
[2022][Solved] Conflicting peer dependency: firebase ...
firebase deploy --only functions ... npm ERR! Could not resolve dependency: ... npm ERR! node_modules/firebase-functions-test
Read more >
Firebase functions cannot find module express
Assuming there are no other libraries, frameworks or custom module loaders ... I went into functions and ran npm install --save firebase and...
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