Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Understanding the Vue CLI Creation Process

Tech 1

When running vue create project-name, the command doesn't require node as a prefix. This behavior stems from how Node.js packages handle executable scripts.

To use Vue CLI, first install it globally:

npm install -g @vue/cli
# or
yarn global add @vue/cli

After installation, check the CLI version with vue --version. The executable location can be found using:

# Windows
where vue
# Mac/Linux
which vue

The vue command is a symlink pointing to node_modules/@vue/cli/bin/vue.js. This JavaScript file begins with a shebang line:

#!/usr/bin/env node

This directive instructs the system to locatte Node.js in the environment and execute the script with it.

To demonstrate this mechanism, create a test file test.js:

#!/usr/bin/env node
console.log('Hello World');

Create a symlink in Node's root directory:

ln -s /path/to/test.js customcmd

Now customcmd can be executed directly from any location in the terminal.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.