I'm using Google Apis to fetch YouTube user info. I already have this working fine in another project, but for some reason I'm getting a strange error in this one. The goal is to fetch a list of videos scoped to a particular playlist id.
I'm using Mithril.js wih coffeescript. Here's the relevant snippet:
google = require 'googleapis'
Properties.controller = (options = {}) ->
@showVideos = (playlistId) =>
youtube = google.youtube('v3')
google.youtube.playlistItems({part:'snippet', playlistId: playlistId}).then(videos) ->
console.log videos
The google client loads fine, but on this line:
youtube = google.youtube('v3')
I get the following error:
Uncaught Error: Unable to load endpoint youtube("v3"): Cannot find module '/node_modules/googleapis/apis/youtube/v3'
I use this exact same code in another project on the same computer in a neighboring directory. They are both using the same version of googleapis (I copied the working folder to this project just to be doubly sure).
I tried doing this with some of the other client endpoints such as with the usage examples. None of them work. So it must be some kind of path variable?
Aucun commentaire:
Enregistrer un commentaire