0

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?

  • Maybe this will be of help to you: https://stackoverflow.com/a/45164863/3397771 – 76484 Mar 12 '22 at 02:02
  • Yes that helped me, thanks! For others, I had to add `npx` before the command to run it locally within its own directory due to the variable `handlesbars` not being available in the command line. Final command was = `npx handlebars example.handlebars -f example.precompiled.js` – user18440676 Mar 14 '22 at 16:30

0 Answers0