'Unable to execute Handlebars <file> -f <file>

We are looking to move Node packages from Global to local directories but are having trouble with the Handlebars packages.

This is the packages.json file currently:

{
  "name": "documents",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.15.5",
    "@babel/eslint-parser": "^7.15.4",
    "@babel/preset-react": "^7.14.5",
    "@types/node": "^16.7.13",
    "eslint": "^8.10.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.3.0"
  },
  "dependencies": {
    "handlebars": "^4.7.7",
    "react": "^17.0.2"
  }
}

If I install this package globally with npm install -g handlebars then run

handlebars example.handlebars -f example.precompiled.js

it works, but when installing Handlebars locally I just get the error

bash: handlebars: command not found

eventhough its installed correctly.

Any ideas why this isn't working locally as I would imagine it would or can the compile only work globally?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source