1

I am building firebase exampple with node.js in here

https://github.com/googlesamples/Firebase-Plays-GCP-2016

My Package.json file

 {
  "name": "game-control",
  "version": "1.0.0",
  "description": "Game controller to relay keystrokes",
  "main": "game-controller.js",
  "private": "true",
  "dependencies": {
    "chance": "^1.0.3",
    "firebase-admin": "4.1.2",
    "firebase-functions": "0.5.1",
    "gcloud": "^0.32.0",
    "prompt": "^1.0.0",
    "robotjs": "^0.3.7",
    "sleep": "^3.0.1"
  },
  "keywords": [
    "game",
    "controller",
    "keystrokes"
  ],
  "author": "Google Inc.",
  "contributors": [
    {
      "name": "Bret McGowen",
      "url": "https://twitter.com/bretmcg"
    }
  ],
  "license": "Apache-2.0"
}

I am getting an error after npm install The npm error log as follows (/home/"username"/.npm/_logs/2017-12-07T14_31_17_723Z-debug.log)

12379 verbose lifecycle grpc@0.13.1~install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bi..............

12380 verbose lifecycle grpc@0.13.1~install: CWD: /home/"username"/Firebase-Plays-GCP-2016/backend/game-controller/node_modules/grpc
12381 silly lifecycle grpc@0.13.1~install: Args: [ '-c', 'node-pre-gyp install --fallback-to-build' ]
12382 silly lifecycle grpc@0.13.1~install: Returned: code: 1  signal: null
12383 info lifecycle grpc@0.13.1~install: Failed to exec install script
12384 verbose unlock done using /home/"Username"/.npm/_locks/staging-6598b7ab8d64c375.lock for /home/"Username"/Firebase-Plays-GCP-2016/backend/game-controller/node_modules/.staging
12385 verbose stack Error: grpc@0.13.1 install: `node-pre-gyp install --fallback-to-build`
12385 verbose stack Exit status 1
12385 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
12385 verbose stack     at emitTwo (events.js:126:13)
12385 verbose stack     at EventEmitter.emit (events.js:214:7)
12385 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
12385 verbose stack     at emitTwo (events.js:126:13)
12385 verbose stack     at ChildProcess.emit (events.js:214:7)
12385 verbose stack     at maybeClose (internal/child_process.js:925:16)
12385 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
12386 verbose pkgid grpc@0.13.1
12387 verbose cwd /home/"Username"/Firebase-Plays-GCP-2016/backend/game-controller
12388 verbose Linux 4.10.0-40-generic
12389 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
12390 verbose node v8.9.2
12391 verbose npm  v5.5.1
12392 error code ELIFECYCLE
12393 error errno 1
12394 error grpc@0.13.1 install: `node-pre-gyp install --fallback-to-build`

I am new to node.js, firebase. My node version : v8.9.2, npm version : 5.5.1

Thanks in advance

user3478108
  • 17
  • 1
  • 1
  • 9
  • This can also happen if you are running the incorrect version of node, for example if you've installed node 12 and firebase is expecting node 10. – jmbmage Oct 02 '20 at 19:50

6 Answers6

4

I had the same issue and I solved it by the command

npm cache clean --force
Abhilash Narayan
  • 157
  • 2
  • 14
2

For me it worked simply to run the command:

npm install -g firebase-tools

with superuser permissions or by executing this command:

sudo -s
Mattia Ferigutti
  • 2,608
  • 1
  • 18
  • 22
1

I faced the same issue, and solved it as follows. I installed

npm install -g firebase@4.6.2

and removed cap ^ in package.json before firebase version.

1

I faced the same issue and solved it as follows. I installed

npm install --save firebase
0

A bunch of those modules are out of date, so I updated the backend dependencies. See this pull request: https://github.com/googlesamples/Firebase-Plays-GCP-2016/pull/1

I was able to get npm to install with those updates on both Mac OS X 10.12 and Windows Server 2016.

Bret McGowen
  • 1,270
  • 11
  • 8
  • Ok. Thanks. I am trying on ubuntu. Will try with these changes. One thing most of firebase examples from google are not upto date. – user3478108 Dec 08 '17 at 00:34
  • npm install failed Error message [ In file included from ../src/keypress.h:6:0, from ../src/robotjs.cc:7: ../src/keycode.h:103:23: fatal error: X11/Xutil.h: No such file or directory ] – user3478108 Dec 08 '17 at 01:03
  • npm install works after installing these packages libxtst-dev libpng++-dev – user3478108 Dec 08 '17 at 01:11
0

I used this command to avoid the issue

npm install firebase --force