runtime.js:23 TypeError: Failed to resolve module specifier “@capacitor/status-bar”. Relative references must start with either “/”, “./”, or “../”.
r.handleError @ runtime.js:23
localhost/:1 Uncaught TypeError: Failed to resolve module specifier “@capacitor/status-bar”. Relative references must start with either “/”, “./”, or “../”.
I am not sure I can reply to your answer my app is a simple one with no framework and with no bundler (I have put on github the source I have started from Aquatime/progressione_app at main · thery/Aquatime · GitHub)
Then I simply execute the following command
npx cap add android
npx cap copy
npx cap update
npm install @capacitor/status-bar
npx cap sync
npm install @capacitor/network
npx cap sync
npx cap open android
then the error happens when I start to run my app in android studio
I am not sure you can use Capacitor without a bundler/build step. Someone can correct me if I am wrong.
But the docs say:
Whatever your command is, you will need to build your web code for distribution in order to use it with Capacitor. (source)
For web assets, cap copy or cap sync just copies the web assets from the defined folder webDir in the Capacitor config file. It expects all required JS to be there.
npm install @capacitor/assets
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated q@1.5.1: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.
npm warn deprecated
npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp)
npm warn deprecated @xmldom/xmldom@0.7.13: this version is no longer supported, please update to at least 0.8.*
npm warn deprecated @xmldom/xmldom@0.7.13: this version is no longer supported, please update to at least 0.8.*
npm error code 1
npm error path /home/thery/git/Aquatime/progressione_app/node_modules/@capacitor/assets/node_modules/sharp
npm error command failed
npm error command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm error sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-linux-x64.tar.br
npm error sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm error sharp: Installation error: Request timed out
Ok I think I have understood. I am using the example of the doc that is using a typescript syntax while my project is pure JS, so I should stick to JS syntax.
This is
if (window.Capacitor) {
const { StatusBar } = Capacitor.Plugins;
for the StatusBar and
if (window.Capacitor) {
const { Network } = Capacitor.Plugins;