Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8501303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:10:31+00:00 2026-06-11T01:10:31+00:00

I am getting an error when running a pre-commit hook in git, that I

  • 0

I am getting an error when running a pre-commit hook in git, that I can’t figure out. This is the script and the error is below.

#!/bin/bash

# Pre-commit hook passing files through jslint and uglify

#ROOT_DIR=$(git rev-parse --show-toplevel)
JSLINT="/home/john/Projects/node/uglify/node_modules/.bin/jslint --indent 4 --white true -nomen"
UGLIFYJS="/home/john/Projects/node/uglify/node_modules/.bin/uglifyjs"
JS_TEMP_EDITOR="/home/john/Projects/node/test/generated/tmp/_combined_editor.js"
JS_COMBINED_EDITOR="/home/john/Projects/node/test/public/javascripts/editor.min.js"

# Where the editor files are located
BASE="/home/john/Projects/node/test/public/javascripts/editor/"
EDITOR=(
    "init.js"
    "utils.js"
    "validation.js"
    "main.js"
    "menu.js"
    "graph.js"
    "settings.js"
    "interview.js"
    "list.js"
    "thumbnail.js"
)

# go through each javascript file that has changed and run it rhough JSLINT
for file in $(git diff-index --name-only --diff-filter=ACM --cached HEAD -- | grep -P '\.((js)|(json))$'); do
    if  ! node $JSLINT $file 2>&1 | grep ${file}' is OK.' ; 
    then
        node $JSLINT $file
        exit 1
    fi  
done


# Erase old
> $JS_TEMP_EDITOR
> $JS_COMBINED_EDITOR

#run thru the EDITOR and cat the files into one
for editor_file in ${EDITOR[@]}; do
  cat "$BASE/$editor_file" >> $JS_TEMP_EDITOR
done


# check if  UGLIFYJS gives us an error
if node $UGLIFYJS $JS_TEMP_EDITOR 2>&1 | grep 'Error' ; 
then
    exit 1
else
        # *** THIS IS WHERE THE ERROR IS THROWN
    "node $UGLIFYJS -o $JS_COMBINED_EDITOR $JS_TEMP_EDITOR"
fi

exit 0

This is the error I am getting:

.git/hooks/pre-commit: line 55: node /home/john/Projects/node/uglify/node_modules/.bin/uglifyjs -o /home/john/Projects/node/test/public/javascripts/editor.min.js /home/john/Projects/node/test/generated/tmp/_combined_editor.js: No such file or directory

I have changed the permissions of all the files to 777 just for testing, and also checked for CR’s anywhere, and I still get the error. The weird part is when I run the command, from the error given, I get no problem!

node /home/john/Projects/node/uglify/node_modules/.bin/uglifyjs -o /home/john/Projects/node/test/public/javascripts/editor.min.js /home/john/Projects/node/test/generated/tmp/_combined_editor.js

will work just fine.

Hopefully someone can see something that I can’t.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:10:33+00:00Added an answer on June 11, 2026 at 1:10 am

    You probably want:

    node "$UGLIFYJS" -o "$JS_COMBINED_EDITOR" "$JS_TEMP_EDITOR"
    

    Otherwise your telling bash to execute a binary at path “/home/john/Projects/node/uglify/node_modules/.bin/uglifyjs -o /home/john/Projects/node/test/public/javascripts/editor.min.js /home/john/Projects/node/test/generated/tmp/_combined_editor.js” which is just what the error message says but maybe a bit confusing as the error message don’t include the quotes, that is just used during argument parsing. So in this case bash ends up seeing a command with just one argument (path to the program to execute) that is very long and does not exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't seem to figure this out. Any ideas why I may be getting
I am getting this error While running this LoadError: Expected /home/user/Desktop/Tripurari/myapp/app/models/host.rb to define Host##
I am getting ERROR when I am running this program at the line static
I'm getting this error message whiile running a Webservice I'm working on. it builds,
I am getting an error running this code. IEnumerable<Activity> activityList = WorkflowInspectionServices.GetActivities(activityCurrent); if (activityList.Count()
Getting Fatal Error while running bin/hadoop namenode -format Using Windows 7 operating system, Under
I am getting this error when running my page through the W3C validator: =
I am getting conversion error when running the below sql in store procedure becasue
I'm getting that error running on MySQL 5.5.8 Mysql2::Error: You have an error in
I'm getting this error when running an MVC3 site on my locahost. It is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.