Open alexstanbury opened 3 weeks ago
@alexstanbury i think there is always something running on your port 5000 either kill/disable it before running on macos this fixed the issue for me: https://stackoverflow.com/questions/72369320/why-always-something-is-running-at-port-5000-on-my-mac
try also nx run my-new-firebase-app:killports
the default serve target generated by the plugin should run the above command as part of the serve command, but I guess it isn't for some reason 🤔
I changed the port of hosting to 5002 to avoid the mac os system conflict, thanks @esterified (not sure why firebase chose that as the default!)
Now, running nx run my-new-firebase-app:killports
then nx serve my-new-firebase-app
gives the following:
alexstanbury@Alexs-Mac-Studio org % nx run my-new-firebase-app:killports
> nx run my-new-firebase-app:killports
> kill-port --port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Could not kill process on port 9099,5001,8080,9000,5000,8085,9199,9299,4000,4400,4500. No process running on port.
Process on port 5000 killed
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target killports for project my-new-firebase-app (322ms)
alexstanbury@Alexs-Mac-Studio org % nx serve my-new-firebase-app
> nx run my-new-firebase-app:serve
NX Running target build for project my-new-firebase-function:
- my-new-firebase-function
With additional flags:
--watch=true
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> nx run my-new-firebase-function:build --watch
[ watch ] build succeeded, watching for changes...
[watch] build finished, watching for changes...
i emulators: Starting emulators: auth, functions, firestore, storage
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project asseticom-uk-staging. This may result in unexpected behavior.
⚠ emulators: Could not find import/export metadata file, skipping data import!
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database, hosting, pubsub, dataconnect
i firestore: Firestore Emulator logging to firestore-debug.log
✔ firestore: Firestore Emulator UI websocket is running on 9150.
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/Users/alexstanbury/Desktop/org/dist/my-new-firebase-function" for Cloud Functions...
⚠ functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.
⚠ functions: Please note that there will be breaking changes when you upgrade.
⚠ functions: Your requested "node" version "16" doesn't match your global version "18". Using node@18 from host.
i functions: Loaded environment variables from .env, .env.local.
Serving at port 8316
✔ functions: Loaded functions definitions from source: helloWorld.
✔ functions[us-central1-helloWorld]: http function initialized (http://127.0.0.1:5001/asseticom-uk-staging/us-central1/helloWorld).
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://127.0.0.1:4000/ │
└─────────────────────────────────────────────────────────────┘
┌────────────────┬────────────────┬─────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Firestore │ 127.0.0.1:8080 │ http://127.0.0.1:4000/firestore │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Storage │ 127.0.0.1:9199 │ http://127.0.0.1:4000/storage │
└────────────────┴────────────────┴─────────────────────────────────┘
Emulator Hub running at 127.0.0.1:4400
Other reserved ports: 4500, 9150
Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
The line ⚠ emulators: It seems that you are running multiple instances of the emulator suite for project asseticom-uk-staging. This may result in unexpected behavior.
suggests emulators are already running, even though killports was run. Aside from that, everything else seems to work ok.
I think for now I'll just stick to using yarn directly.
A lot of that killport shenanigans is necessary atm only because Nx doesnt kill processes cleanly, so the emulator continues running after ctrl+c exit I added a special serve executor in the plugin to fix that, but Nx 17+ changed things again and the 'fix' no longer seems to work - see #238 😞
Using your install instructions from the readme, I run:
npx create-nx-workspace@latest
Which creates a fresh
19.1.2
NX workspace.Then I run:
npx nx g @simondotm/nx-firebase:app my-new-firebase-app --project=my-project-name-here
then:
npx nx g @simondotm/nx-firebase:function my-new-firebase-function --app=my-new-firebase-app
Then I comment in the
helloWorld
function in the function app.According to your docs I should be able to run
npx nx build my-new-firebase-app
and it will build the associated function, but it doesn't, I just get the outputRunning the build for the function itself works fine
npx nx build my-new-firebase-function
.Also, running
npx nx serve my-new-firebase-app
gives the following error output:Running
npx nx emulate my-new-firebase-app
works as expected.This also happens using NX version
18.1.2
.