Course lesson
Make a Node.js Script Globally Executable with a Shebang and a Symbolic Link
A CLI isn't super useful if you have to be inside of the project to start the script.
- Duration
- 3 min
- Access
- Included
- Transcript
- Retained from source evidence
A CLI isn't super useful if you have to be inside of the project to start the script.
To fix this, we can add a #! (shebang) to the top of our entry file. On linux and MacOS systems you'll also have to make the file executable as well. Then we can use a symbolic link to add a custom quizme command to our path that points at our scripts entry file.
We'll need to fix one more thing though! If you try to run the script in a different directory, the file it references for ./data.json will be incorrect, we'll fix this in the next lesson.