我试图让车把安装以进行预编译模板。我已经按照安装说明(http://handlebarsjs.com/precompilation.html)进行安装,我似乎没有任何问题(见下文)。但是当我发出编译命令时......
handlebars users.handlebars -f templates.js
无法找到把手命令。
-bash: handlebars: command not found
很想知道这个。
(username) ~$ which npm
/usr/local/bin/npm
(username) ~$ which node
/usr/local/bin/node
(username) ~$ npm install -g handlebars
npm http GET https://registry.npmjs.org/handlebars
npm http 304 https://registry.npmjs.org/handlebars
npm http GET https://registry.npmjs.org/uglify-js
npm http GET https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/uglify-js
npm http 304 https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/wordwrap
/usr/local/share/npm/bin/handlebars -> /usr/local/share/npm/lib/node_modules/handlebars/bin/handlebars
handlebars@1.0.7 /usr/local/share/npm/lib/node_modules/handlebars
├── uglify-js@1.2.6
└── optimist@0.3.4 (wordwrap@0.0.2)
(username) ~$ cd Sites/projectone/templates/
(username) ~/Sites/projectone/templates (master)$ ll
total 8
drwxr-xr-x 3 username ec_earth 102 Sep 26 23:57 .
drwxr-xr-x 10 username ec_earth 340 Sep 26 23:58 ..
-rw-r--r-- 1 username ec_earth 17 Sep 26 23:57 users.handlebars
(username) ~/Sites/projectone/templates (master)$ handlebars users.handlebars -f templates.js
-bash: handlebars: command not found
答案 0 :(得分:2)
您需要使用node_modules/.bin
目录的完整路径(它们不会自动添加到您的路径中)。
/usr/local/share/npm/lib/node_modules/.bin/handlebars users.handlebars -f template.js