Skip to content

Instantly share code, notes, and snippets.

@badarshahzad
Created December 28, 2017 12:43
Show Gist options
  • Save badarshahzad/f5260022edfea28527f882e61d20d672 to your computer and use it in GitHub Desktop.
Save badarshahzad/f5260022edfea28527f882e61d20d672 to your computer and use it in GitHub Desktop.
Firebase deploy is not working
{
"rules": {
".read": "true",
".write": "true"
}
}
badar:firbase-funcitons$ firebase deploy functions
Error: Too many arguments. Run firebase help deploy for usage instructions
badar:firbase-funcitons$ sudo firebase deploy functions
[sudo] password for badar:
Error: Too many arguments. Run firebase help deploy for usage instructions
Having trouble? Try firebase deploy --help
badar:firbase-funcitons$ sudo firebase deploy --only functions
=== Deploying to 'pcbs-25985'...
i deploying functions
i functions: ensuring 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-admin'
Try running "npm install" in your functions directory before deploying.
Having trouble? Try firebase deploy --help
badar:firbase-funcitons$ cd functions/
badar:functions$ ls
index.js node_modules package.json
badar:functions$ sudo npm install
> grpc@1.6.6 install /root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.6.6/node-v59-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.6.6 and node@9.2.0 (node-v59 ABI) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/build'
gyp ERR! System Linux 4.4.0-104-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64/grpc_node.node" "--module_name=grpc_node" "--module_path=/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64"
gyp ERR! cwd /root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc
gyp ERR! node -v v9.2.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64/grpc_node.node --module_name=grpc_node --module_path=/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:159:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:943:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Linux 4.4.0-104-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc
node-pre-gyp ERR! node -v v9.2.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64/grpc_node.node --module_name=grpc_node --module_path=/root/AndroidStudioProjects/PCBS/firbase-funcitons/functions/node_modules/firebase-admin/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.6.6 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.6.6 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! /home/badar/.npm/_logs/2017-12-28T12_15_39_886Z-debug.log
drwxr-xr-x 3 root root 4096 دسمبر 28 13:36 .
drwxr-xr-x 3 root root 4096 دسمبر 28 17:12 ..
-rw-r--r-- 1 root root 14 دسمبر 28 12:30 .gitignore
-rw-r--r-- 1 root root 295 دسمبر 28 13:10 index.js
drwxr-xr-x 69 root root 4096 دسمبر 28 17:15 node_modules
-rwxr-xr-x 1 root root 208 دسمبر 28 13:15 package.json
{
"database": {
"rules": "database.rules.json"
}
}
const functions = require('firebase-functions');
// Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
exports.helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
{
"name": "pcbs-electric-system",
"description": "Cloud Functions for pcbs electric system",
"dependencies": {
"firebase-admin": "5.4.2",
"firebase-functions": "0.7.1"
},
"private": true
}
@badarshahzad
Copy link
Author

Issue solved I was doing all the firebase work in the root directory and it was already tedious while I was using command to install dependencies!
Remember just create on desktop folder or in a directory where the file permission are not restrict then you can do it just few seconds as compare to me I wasted whole day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment