Google-api-nodejs-client: Internal Error with Mime

Created on 30 Apr 2020  路  2Comments  路  Source: googleapis/google-api-nodejs-client

I installed the library from npm, and I got this error from simply requiring it:

TypeError: typeMap[type].map is not a function
    at Mime.define (/app/node_modules/mime/Mime.js:41:36)
    at new Mime (/app/node_modules/mime/Mime.js:12:10)
    at Object.<anonymous> (/app/node_modules/mime/index.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/app/node_modules/gtoken/build/src/index.js:20:14)

the stacktrace suggests it's an error with Mime, which this library does not have as a dependency, but assumably, one of the dependencies in a dependency tree does.

Environment details

  • OS: Linux (VPS: Heroku)
  • Node.js version: 12.16.3
  • npm version: 6.14.4
  • googleapis version: I've tried both latest (49.0.0) and 39.0.0, as the developers article suggested.

Steps to reproduce

  1. simply requiring 'googleapis'. (require('googleapis'))
  2. ?

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

needs more info p2 bug

All 2 comments

Greetings @1s3k3b! I am struggling to recreate this one locally. Could I trouble you to try a few things?

rm -rf node_modules package-lock.json
npm install

If it's still not working after that, can you share your package.json?

Also, if you could run npm ls mime and share the output, that would be helpful.

That seems to have fixed it, thank you for the response!

Was this page helpful?
0 / 5 - 0 ratings