產卵紅寶石青菜我有腳本調用sassy.js試圖從節點
var spawn = require('child_process').spawn,
rubySass = spawn('sass', ['--watch scss:.tmp/css', '--sourcemap=auto', '--style=expanded', '--unix-newlines']);
,我嘗試使用節點sassy.js
$ node sassy.js
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn sass ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
很奇怪,因爲這個代碼工作運行:
var exec = require('child_process').exec,
rubySass = exec('sass --watch scss:.tmp/css --sourcemap=auto --style=expanded --unix-newlines');
我選擇spawn beacuse最後我想返回stdout,我可以通過npm運行腳本將其重定向到節點包clean-css
"scripts": {
"build-sass:clean": "node sassy.js |
}
有:npm run build-sass:clean
EDITED
後幫從Lovell Fuller我更新sassy.js rubySass = spawn('c:/Ruby21-x64/bin/sass', ['--watch scss:.tmp/css', '--sourcemap=auto', '--style=expanded', '--unix-newlines'])
但node sassy.js
劇照yelds
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn c:/Ruby21-x64/bin/sass ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
我試着c:/Ruby21-x64/bin/sass.bat
,但儘管沒有錯誤,也沒有輸出,以及: -/
包括'.bat'後綴是正確的方法。 – 2015-04-15 20:54:33