Aggiungere il pacchetto Mojo
Installi Mojo tramite la toolchain Modular.
Aggiungere il pacchetto Mojo è una lezione Mojo Academy gratuita su CoddyKit. Questa è la lezione 2 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Mojo Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Mojo Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
The CLI Is Not Mojo Yet
Installing magic gave you the manager, not the language. Now you add Mojo itself into a project through that toolchain. 📦
Projects Hold Your Toolchain
With magic, Mojo lives inside a project folder. Each project gets its own pinned version, so different apps never clash.
Create a New Project
Start by making a project. The magic init command scaffolds a folder ready to hold Mojo and its dependencies.
magic init my-mojo-appStep Into the Folder
Move into the new directory so the next commands run in the right place. This folder is your project root.
cd my-mojo-appAdd the Mojo Package
Pull Mojo into the project with magic add. This downloads the compiler and standard library as a package the project depends on.
magic add mojoThe Manifest File
Your dependencies are tracked in a pixi.toml manifest. Adding mojo records it there so the setup is reproducible later.
The Lock File
Alongside the manifest sits a lock file pinning exact versions. It guarantees teammates get the very same toolchain you have.
Enter the Environment
Activate the project so its tools are on your PATH. Inside a magic shell, the mojo command becomes available to you.
magic shellRun Without Activating
Prefer not to enter a shell? Prefix any command with magic run to use the project's Mojo for just that one command.
magic run mojo --versionMojo Is Now Local
Because Mojo lives in the project, deleting the folder removes it cleanly. Nothing is scattered globally across your system.
Share It with Others
Commit pixi.toml and the lock file to git. A teammate then runs magic install to recreate the exact same Mojo setup.
magic installQuick Check
Recall the command that pulls Mojo into your project after you create it.
Recap
You ran magic init, then magic add mojo, and the package landed in pixi.toml. Enter it with magic shell to use mojo. 🎯
Domande Frequenti
La lezione «Aggiungere il pacchetto Mojo» è gratuita?
Sì — il testo completo di «Aggiungere il pacchetto Mojo» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Mojo Academy, passa a CoddyKit PRO. Il corso Mojo Academy include 4 lezioni in totale.
Cosa imparerò in «Aggiungere il pacchetto Mojo»?
Installi Mojo tramite la toolchain Modular. Eserciti Mojo Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Mojo Academy?
Non è richiesta alcuna esperienza precedente. Mojo Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 2 di 4.
Quanto tempo richiede la lezione «Aggiungere il pacchetto Mojo»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Mojo Academy?
Sì. Ogni lezione Mojo Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Installare la Modular CLI
- Aggiungere il pacchetto Mojo
- Verificare la versione
- Configurare l'editor per Mojo