2012-09-27 4 views
2

템플릿을 프리 컴파일하는 데 handlebar를 설치하려고했습니다. 설치 지침 (http://handlebarsjs.com/precompilation.html)을 따라했으며 설치를 실행하는 데 문제가없는 것 같습니다 (아래 참조). 그러나 컴파일 명령을 내릴 때 ...Handlebars.compile 사용 중 문제

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 
[email protected] /usr/local/share/npm/lib/node_modules/handlebars 
├── [email protected] 
└── [email protected] ([email protected]) 
(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 

답변

2

당신은 (그들은 자동으로 경로에 추가되지 않습니다)에 node_modules/.bin 디렉토리의 전체 경로를 사용해야합니다.

/usr/local/share/npm/lib/node_modules/.bin/handlebars users.handlebars -f template.js 
+0

친애하는 @Bill 저는 매우 비슷한 문제가 있습니다. 그러나 나는 올바른 길을 찾을 수없는 것 같습니다. 내가 가지고있는 것은'c : \ users \ b \ downloads \ node-v7.1.0-win-x64 \ node_modules'이고, 가능한 두 개의 폴더 인'handlebars'와'npm'을 가지고 있습니다. 내부에는 handlebars가 있는데'node_modules/.bin'이 있지만 내부에 'handlebars'가 없습니다 ... 어떤 도움이 필요합니까? 감사 –