Closed proimage closed 2 years ago
@proimage we made those a standalone container so that is somewhat expected, but not ideal. Runing nitro clean
will account for those orphaned containers and remove them.
Hmm. I'll keep the clean
command in mind. So far, I've switched from nitro npm run watch
to nitro ssh
+ npm run watch
. Those are basically (basically) identical, right?
Kind of, the nitro ssh
puts you inside the site container (like ssh'ing into a remote server). The nitro nom <cmds>
creates a brand new container using the official node image that is detached from your site - which is why you get those orphaned containers.
Does that make more sense?
nitro nom
? /me is hungry #nomnomnom 😁
So it's the difference of using the existing site container to run NPM on "local" files, vs using a temp container to run NPM on "remote" (to that container) files?
Hi, we are closing this issue as we have decided to retire Nitro, so no additional work will occur on this project. You can read the official blog post here https://craftcms.com/blog/retiring-craft-nitro. We appreciate everyones feedback and involvement and we look forward to refocusing our efforts on Cloud!
If you're looking for a new local development environment, we recommend DDEV and have a knowledge base article to help you with the transition: https://craftcms.com/knowledge-base/migrating-from-craft-nitro-to-ddev.
Description
I compile assets (SCSS & JS) using Laravel Mix'snpm run watch
in the Nitro container of whichever client site I'm working on, by runningnitro npm run watch
. Once I've finished the updates, I press CTRL+C to stop that process, and then I compile for production using:nitro npm run production
. That second process is a run-and-exit process, not a run-and-watch process (from NPM's POV). Yet occasionally, I'll find that these processes seem to still be running in the background... the assets will get compiled in the background, VS Code will show that there's unexpectedly changed files in the Source Control panel, and Docker Desktop will show at least one randomly-named container (currently it'secstatic_wright
). This usually only happens if I've been watching and compiling assets in a gitfeature/*
branch, and then I switch to another branch such asmaster
to pull those feature changes in... NPM seems to seemaster
's "changed" source assets when the branch gets switched, and recompiles them automatically.Any ideas or suggestions as to why compilation processes aren't terminating properly?EDIT: A better explanation, now that I understand things a bit more:
When running
nitro npm run watch
, pressing CTRL+C seems to back out of that nitro / container wrapper for the NPM process, instead of terminating the NPM process itself. This leaves NPM still running in the temporary container that was created for it, still watching for changes and compiling things. :-/When instead I run
nitro ssh
from the project direction, and thennpm run watch
from inside that container, pressing CTRL+C terminates the NPM process as expected.Is there a better or more proper way to terminate
nitro npm run watch
processes?Steps to reproduce
Additional info