sketch-hq / SketchAPI

The JavaScript plugin library embedded in Sketch
https://developer.sketch.com/reference/api
MIT License
842 stars 126 forks source link

Error: 'libraryController.libraries' is undefined #904

Closed SunilWang closed 1 year ago

SunilWang commented 1 year ago

My sketch version is 94

TypeError: libraryController.libraries is not a function. (In 'libraryController.libraries()', 'libraryController.libraries' is undefined)

How can this problem be solved?

rodionovd commented 1 year ago

I believe this Sketch library controller API method has been renamed from libraries() to appLibraries() in Sketch 94.

If I understand this correctly, Sketch.app (94+) actually bundles a fixed version of the JS API – and the one here on GitHub is outdated (and thus still mentions the old method name).

SunilWang commented 1 year ago

@rodionovd Thank you very much, this question has bothered me for a long time!

SunilWang commented 1 year ago

SketchApi.js is found in the Sketch installer: n_v3395a7d2bef3f4c0a88b109622ac4b524

Now the source code on github: https://github.com/sketch-hq/SketchAPI/blob/develop/Source/dom/models/Library.js#L43

elfenlaid commented 1 year ago

So sorry about that 🙇 Indeed, the public repo ended up in a de-synced state

This PR https://github.com/sketch-hq/SketchAPI/pull/905 synched the changed from the latest Sketch version (v94.1) to the repo

SunilWang commented 1 year ago

That seems to have been solved. Thank you very much.