GoogleChromeLabs / bubblewrap

Bubblewrap is a Command Line Interface (CLI) that helps developers to create a Project for an Android application that launches an existing Progressive Web App (PWAs) using a Trusted Web Activity.
Apache License 2.0
2.38k stars 162 forks source link

bubblewrap init returns command not found #657

Open Zeesy opened 2 years ago

Zeesy commented 2 years ago

Describe the bug Running bubblewrap init --manifest=http://localhost:8000/static/manifest.webmanifest results in -bash: bubblewrap: command not found

To Reproduce Steps to reproduce the behavior:

  1. npm i -g @bubblewrap/cli results in
    changed 324 packages, and audited 325 packages in 25s
    ...
    found 0 vulnerabilities
  2. bubblewrap init --manifest=http://localhost:8000/static/manifest.webmanifest (or manifest.json. index.html is in /static)
  3. See error -bash: bubblewrap: command not found

Expected behavior Expecting Bubblewrap to start after init command

Desktop (please complete the following information):

Additional context

LupusX5 commented 2 years ago

Try these steps: 1) place the url inside of quotes: bubblewrap init --manifest="http://localhost:8000/static/manifest.webmanifest" (but better place there a manifest.json, as specified in the docs). 2) open the directory itself - if you don't observe any json output – there's something wrong with your directory. 3) replace localhost by your local IP address (usually looks like something like this: 192.168.0.09.) or better by ngrok or surge. Where to find on MacOS: System Configuration --> Network

image
Zeesy commented 2 years ago

Thanks for your reply. Using quotes doesn't produce any new json files in the /static directory. Is that what you mean by json output? There is no new info for bubblewrap in the manifest.json after running it either. Replacing localhost with the local IP address results in the same bash error. What could be wrong with the directory?

andreban commented 2 years ago

It seems the problem is related to bash being unable to find the binary instead. Maybe something like this: https://stackoverflow.com/questions/70999596/node-and-npm-not-found-after-restarting-macos

skedwards88 commented 1 year ago

I am also hitting this same error. bubblewrap -h and bubblewrap init both return zsh: command not found: bubblewrap. The stackoverflow linked above does not solve this issue either; node -v and npm commands work fine for me.

(My node version is v18.12.0 and I am on MacOS.)

andreban commented 1 year ago

It seems like Node failed to simlink files - would you mind providing more context on how Node is installed? (eg: via Homebrew, NVM, etc?)

pedro199288 commented 1 year ago

having the same error. In my case I use node 18.13.0 and MacOS with apple silicon M1 chip. My node version is installed via NVM. I've tried both with npm and pnpm and I have the same result. Also if I use npx bubblewrap init --manifest=https://some-url-here/manifest.json I get this error:

npm ERR! could not determine executable to run

tomasdev commented 1 year ago

In my case it worked but got:

? Domain: (localhost:8000) localhost:8000
>> Invalid URL: localhost:8000
tbabik commented 10 months ago

In case it helps. I was also experimenting with a local PWA. Manifest from http://localhost:8000 was no problem. Then I ran into the domain issue as well. I just populated it with https://127.0.0.1 (it also complained about needing to be HTTPS).

Don't build it yet. Instead go to app/build.gradle and update the twaManifest definition, there should be a parameter hostName containing the 127.0.0.1 - change it to localhost and port if needed i.e. localhost:8000

Then serach for "launchUrl" and change the protocol from https:// to http:// (if needed).

I was then able to run bubblewrap build and my local PWA seems to work fine that way.