1

Step 1: I try to add googleapis as dependency and got the error

$ npm install googleapis
npm WARN saveError ENOENT: no such file or directory, open '[home]/package.json'
npm WARN enoent ENOENT: no such file or directory, open '[home]/package.json'
npm WARN saly No description
npm WARN saly No repository field.
npm WARN saly No README data
npm WARN saly No license field.

Question: Why is it looking for the file in my home directory as opposed to my project directory? Especially since I am making the call from my project directory.

Step 2: I misunderstood the error and proceeded to deploying my project and that's where I got the error

Module 'googleapis' is not listed as dependency in package.json

Step 3: I now try npm i googleapis --save but I still get the same errors as in steps 1 and 2.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
salyela
  • 1,325
  • 3
  • 14
  • 26
  • I'm just doing exactly as here: https://www.npmjs.com/package/googleapis – salyela Jun 12 '19 at 17:50
  • did you run `npm init` in your project directly to create a `package.json` file? – Mike Diglio Jun 12 '19 at 18:03
  • yeah I just did that and nothing changed. I followed suggestions as here: https://stackoverflow.com/questions/9484829/npm-cant-find-package-json/37687665#37687665 – salyela Jun 12 '19 at 18:09
  • In VSCode I do see a package.json file and inside it I see the dependency listed as `"dependencies": { "@google-cloud/firestore": "^2.2.0", "googleapis": "^40.0.0" }` So I don't know why deploy is not working – salyela Jun 12 '19 at 18:11

1 Answers1

3

It seems that the problem was due to that I forgot to cd into the functions directory before I tried to install the dependencies.

salyela
  • 1,325
  • 3
  • 14
  • 26