Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such module 'Capacitor' #109

Closed
jafaircl opened this issue Jul 10, 2024 · 2 comments
Closed

No such module 'Capacitor' #109

jafaircl opened this issue Jul 10, 2024 · 2 comments

Comments

@jafaircl
Copy link

I'm following the docs here for creating a plugin:

https://capacitorjs.com/docs/plugins/creating-plugins

When I run npm init @capacitor/plugin@latest, everything seems to be created fine. But, when I open the package in Xcode, I get an error No such module 'Capacitor' when I open the plugin .swift file. The package fails to build. I don't make any changes before attempting to build the plugin.

I'm on Xcode version 15.4 and node 20.13.1

(There is also an issue building the web version but that is because of type errors in the dependencies. Setting "skipLibCheck": true and "types": [] in the compiler options in tsconfig.json fixes that issue)

@jafaircl
Copy link
Author

I think I tracked down the root issue. In Xcode the build destination was selected as "My Mac" under Product > Destination. This caused an error in Capacitor that says "While building for macOS, no library for this platform was found in {{ build directory }}". Setting the build destination as "Any iOS Device" under Product > Destination allowed me to build the plugin with no errors. I'm on a M2 Mac so maybe it's an Apple silicon issue. I'll leave this issue open so others can find it and/or you can add it to the docs if you see fit. Feel free to close once you decide. Thanks!

@jcesarmobile
Copy link
Member

Yeah, Capacitor plugins are iOS only at the moment.

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants