- Check version with:
node -v
,npm -v
at CMD (Window) or Terminal (MacOS)
❗️ ERROR:
['node' is not recognized as an Internal or external command, operable program or batch file]
💻 Resolve:
- Computer > Local disk (C) > Program Files > nodejs
- Copy directory path (Ctrl + C)
- Right click on Computer - Properties - Advanced system settings
- At System Properties: select tab Advanced - Environments variables
- At Environments Variables: double click Path in System variables table
- At Edit environments variables: New - Paste directory path (Ctrl + V) > OK > OK > OK
- Restart the CMD
- Recheck node version:
node -v
❗️ ERROR:
[command not found: node]
💻 Resolve:
- Try type command in terminal:
sudo nano /etc/paths
- Enter your password
- Press Down key to the last line and press Enter key
- Enter
/usr/local/bin
- Press Control + X or (Command + X)
- Press Y key - Press Enter key
- Restart the terminal
- Recheck node version:
node -v
- Usually ruby (and gem) are pre-installed on MacOS.
- Check version with:
ruby -v
,gem -v
at CMD (Window) or Terminal (MacOS)
❗️ ERROR:
['ruby' is not recognized as an Internal or external command, operable program or batch file]
💻 Resolve:
- Computer - Local Disk C - Ruby - bin
- Do the same steps as resolve with NodeJS
- Instal sass with:
gem instal sass
❗️ ERROR:
[While executing gem ...(Gem:FilePermissionError). You don't have write permission for the /Library/Ruby/Gems/... directory]
💻 Resolve:
-
Try type command in terminal:
sudo gem instal sass
-
Enter your password
-
If an error message appears [ERROR: Failed to build gem native extension]
Continue with the steps below.
-
Try type command in terminal:
x-code-select --install
-
Continue with x-code installation steps
-
Restart the terminal
-
Re-instal sass with:
sudo gem instal sass
-
Enter your password
- Copy the directory path this new folder
- At CMD (Window) or Terminal (MacOS), type:
cd [Paste the directory path]
- Type command:
npm init
- Enter 'package name' (project name)
- Can be skip the version, description, entry point, text command, git repository, keywords, author, license with Enter key
- Is this OK? - Enter key
- Complete this step if the 'package.json' file exists in the folder you just created
- cd the project folder same like step 4.1 - 4.2
- Run command:
npm install --save-dev grunt
- Complete this step if the 'node_module' folder and the 'package-lock.json' file exists in the folder you just created
- cd the project folder same like step 4.1 - 4.2
- Run command:
npm install --save-dev load-grunt-tasks
- cd the folder same like step 4.1 - 4.2
- Run command:
npm install --save-dev grunt-contrib-cssmin
- Create the 'css' folder in the project folder
- Create the 'libs' folder in the 'css' folder
- Copy and paste any 'style.css' file in the 'css' folder
- At CMD (Window) or Terminal (MacOS), run command:
grunt cssmin
- Complete this step if the 'dest' folder file exists in the project folder and inside it, we have a file named 'stylelibs.min'
[Command grunt cssmin
has the effect of turning a multi-line css file into a single-line css file]
❗️ ERROR: about_Execution_Policies
💻 Resolve:
- Open Windows Powershell with option Run as administrator
- Run command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Press Y key
- Create your own copy of GruntTemplate by forking the repository. Once you have created your own fork, clone the repository to your local machine
- Make sure to replace YOUR_GITHUB_USERNAME with your actual username
- Open CMD (Window) or Terminal (MacOS), type command:
git clone https://github.com/YOUR_GITHUB_USERNAME/grunt-template YOUR_PROJECT_NAME
cd YOUR_PROJECT_NAME
- Finally, link your fork back to the upstream repo so you can pull the latest updates and contribute changes back.
git remote add upstream https://github.com/nqnduy/grunt-template
- Open your project and enjoy 🚀