2015-12-15 59 views
31

我想在Mac OS上運行的節點4.2.2,我不理解爲什麼我每次收到此錯誤信息:events.js:141 throw er; //未處理的「錯誤」事件

events.js:141 
     throw er; // Unhandled 'error' event 
    ^
Error: spawn /Users/user/Documents/Projects/project-x/node_modules/gifsicle/vendor/gifsicle ENOENT 
    at exports._errnoException (util.js:874:11) 
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32) 
    at onErrorNT (internal/child_process.js:344:16) 
    at doNTCallback2 (node.js:441:9) 
    at process._tickCallback (node.js:355:17) 
c12320:project-x user$ 

什麼錯? 如果我運行「一飲而盡打造」有這樣的輸出:

c12320:project-x user$ gulp build 
[15:13:41] Using gulpfile ~/Documents/Projects/project-x/gulpfile.js 
    [15:13:41] Starting 'clean'... 
    [15:13:41] Finished 'clean' after 160 μs 
    [15:13:41] Starting 'build'... 
    [15:13:41] Starting 'copy-assets'... 
    [15:13:41] Finished 'copy-assets' after 13 ms 
    [15:13:41] Starting 'minify-img'... 
    [15:13:41] Starting 'compile-css'... 
    [15:13:41] Starting 'compile-js'... 
    [15:13:41] Finished 'build' after 52 ms 
    [15:13:41] 'minify-img' errored after 468 ms 
    [15:13:41] Error: EACCES: permission denied, mkdir '/Users/user/Documents/Projects/project-x/public/assets/img/dummy' 
     at Error (native) 

    assets/js/00-bootstrap.js 
     line 3 col 5 Missing "use strict" statement. 

     ✖ 1 error ⚠ 0 warning 

    [15:13:41] Plumber found unhandled error: 
    Error: EACCES: permission denied, open '/Users/user/Documents/Projects/project-x/public/assets/css/develop.css' 

    assets/js/dev/lib/lodash.js 
     line 13 col 5 Missing "use strict" statement. 
     line 13 col 9 Expected an identifier and instead saw 'undefined' (a reserved word). 
     line 217 col 12 Strings must use singlequote. 
     line 227 col 21 Strings must use singlequote. 
     line 249 col 12 Strings must use singlequote. 
     line 249 col 17 Strings must use singlequote. 
     line 263 col 67 Expected '===' and instead saw '=='. 
     line 374 col 31 Expected '===' and instead saw '=='. 
     line 386 col 24 Expected '===' and instead saw '=='. 
     line 565 col 44 Expected '!==' and instead saw '!='. 
     line 565 col 81 Expected '===' and instead saw '=='. 
     line 577 col 42 Expected '===' and instead saw '=='. 
     line 589 col 85 Expected '===' and instead saw '=='. 
     line 589 col 103 Expected '===' and instead saw '=='. 
     line 589 col 123 Expected '===' and instead saw '=='. 
     line 589 col 143 Expected '===' and instead saw '=='. 
     line 590 col 62 Expected '===' and instead saw '=='. 
     line 590 col 82 Expected '===' and instead saw '=='. 
     line 590 col 102 Expected '===' and instead saw '=='. 
     line 590 col 122 Expected '===' and instead saw '=='. 
     line 590 col 142 Expected '===' and instead saw '=='. 
     line 590 col 163 Expected '===' and instead saw '=='. 
     line 805 col 54 Unexpected use of '>>>'. 
     line 814 col 38 Missing '()' invoking a constructor. 
     line 995 col 33 Missing '()' invoking a constructor. 
     line 995 col 13 The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype. 
     line 1037 col 42 Expected '!==' and instead saw '!='. 
     line 1063 col 66 Expected '!==' and instead saw '!='. 
     line 1208 col 72 Expected '===' and instead saw '=='. 
     line 1208 col 95 Expected '===' and instead saw '=='. 
     line 1226 col 36 Expected '===' and instead saw '=='. 
     line 1229 col 40 Expected '===' and instead saw '=='. 
     line 1229 col 59 Blocks are nested too deeply. (4) 
     line 1231 col 36 Blocks are nested too deeply. (4) 
     line 1278 col 26 Expected '===' and instead saw '=='. 
     line 1291 col 26 Expected '!==' and instead saw '!='. 
     line 1305 col 23 Expected '!==' and instead saw '!='. 
     line 1323 col 66 Missing '()' invoking a constructor. 
     line 1340 col 42 Expected '===' and instead saw '=='. 
     line 1355 col 32 Expected '===' and instead saw '=='. 
     line 1400 col 44 Expected an assignment or function call and instead saw an expression. 
     line 1416 col 27 'arrayEach' was used before it was defined. 
     line 1678 col 17 Bad line breaking before '?'. 
     line 1721 col 29 Expected '===' and instead saw '=='. 
     line 1722 col 17 Bad line breaking before '?'. 
     line 1737 col 38 Expected '===' and instead saw '=='. 
     line 1764 col 35 Expected an assignment or function call and instead saw an expression. 
     line 1788 col 24 Expected '===' and instead saw '=='. 
     line 1790 col 21 Bad line breaking before '?'. 
     line 1793 col 24 Expected '===' and instead saw '=='. 
     line 1793 col 24 Too many errors. (14% scanned). 

     ✖ 2 errors 
     ⚠ 49 warnings 


    assets/js/dev/lib/modernizr.js 
     line 2 col 12449 This character may get silently deleted by one or more browsers. 
     line 2 col 3272 Missing "use strict" statement. 
     line 2 col 3308 Missing semicolon. 
     line 2 col 3368 Expected '{' and instead saw 'if'. 
     line 2 col 3509 Expected '{' and instead saw 'for'. 
     line 2 col 3548 Blocks are nested too deeply. (4) 
     line 2 col 3548 Expected '{' and instead saw 'A'. 
     line 2 col 3615 Strings must use singlequote. 
     line 2 col 3648 Expected '{' and instead saw 'o'. 
     line 2 col 3668 Strings must use singlequote. 
     line 2 col 3772 Do not use Boolean as a constructor. 
     line 2 col 3845 Strings must use singlequote. 
     line 2 col 3851 Strings must use singlequote. 
     line 2 col 3863 Strings must use singlequote. 
     line 2 col 3864 Expected an assignment or function call and instead saw an expression. 
     line 2 col 3865 Missing semicolon. 
     line 2 col 3952 Strings must use singlequote. 
     line 2 col 4036 Strings must use singlequote. 
     line 2 col 4053 Strings must use singlequote. 
     line 2 col 4073 Strings must use singlequote. 
     line 2 col 4082 Strings must use singlequote. 
     line 2 col 4083 Missing semicolon. 
     line 2 col 4124 Strings must use singlequote. 
     line 2 col 4137 Strings must use singlequote. 
     line 2 col 4200 Expected an assignment or function call and instead saw an expression. 
     line 2 col 4201 Missing semicolon. 
     line 2 col 4235 Strings must use singlequote. 
     line 2 col 4237 Expected '===' and instead saw '=='. 
     line 2 col 4246 Expected '{' and instead saw 'for'. 
     line 2 col 4261 Expected '{' and instead saw 'hasOwnProp'. 
     line 2 col 4292 Expected an assignment or function call and instead saw an expression. 
     line 2 col 4246 The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype. 
     line 2 col 4334 Strings must use singlequote. 
     line 2 col 4360 Expected '===' and instead saw '=='. 
     line 2 col 4393 Strings must use singlequote. 
     line 2 col 4395 Expected '!==' and instead saw '!='. 
     line 2 col 4404 Expected '{' and instead saw 'return'. 
     line 2 col 4433 Strings must use singlequote. 
     line 2 col 4435 Expected '===' and instead saw '=='. 
     line 2 col 4453 Expected '===' and instead saw '=='. 
     line 2 col 4551 Do not use Boolean as a constructor. 
     line 2 col 4625 Expected '!==' and instead saw '!='. 
     line 2 col 4629 Strings must use singlequote. 
     line 2 col 4635 Strings must use singlequote. 
     line 2 col 4647 Strings must use singlequote. 
     line 2 col 4673 Expected an assignment or function call and instead saw an expression. 
     line 2 col 4674 Missing semicolon. 
     line 2 col 4691 Missing semicolon. 
     line 2 col 4733 Strings must use singlequote. 
     line 2 col 4735 Expected '!==' and instead saw '!='. 
     line 2 col 4735 Too many errors. (40% scanned). 

     ✖ 2 errors 
     ⚠ 49 warnings 

    [15:13:42] Plumber found unhandled error: 
    Error: EACCES: permission denied, open '/Users/user/Documents/Projects/project-x/public/assets/js/app-load.js' 
    events.js:141 
      throw er; // Unhandled 'error' event 
     ^

    Error: EACCES: permission denied, open '/Users/user/Documents/Projects/project-x/public/assets/font/text/125eafff-7b5a-4c56-8a3a-d3fe11d8c3cc.svg' 
     at Error (native) 
    c12320:project-x user$ 

這就是輸出,如果我輸入「一飲而盡構建」

+0

沒有足夠的信息來幫助你。你想做什麼?跑吞嚥?什麼任務? – Andy

+0

正如@Andy所說,儘可能提供儘可能多的相關信息,以便您能夠獲得幫助。你有什麼嘗試?你寫了什麼代碼? –

+0

嘗試'sudo chown -R $(whoami)/ Users/user/Documents/Projects/project-x'來修復您的EACCES錯誤。 – lxe

回答

0

ENOENT意味着spawn無法找到你正在尋找的二進制文件。確保你想要的任何東西spawn在你的道路上。

在這種情況下,您可能沒有安裝gifsicle。

+0

我已經安裝了gifsicle或imagemin-gifsicle,但它不起作用。 –

+0

你好嗎?你是怎麼安裝飲料的?該文件夾的權限是什麼? 'ls -l'會提供更多信息。 – Breedly

1

修復了這個問題。 資產的權限存在問題 - 如果吞噬不能獲得所有資產。然後總是會顯示一個錯誤。 我手動刪除了資產。我認爲我必須小心(出)「sudo」 - 命令...

0

這不會涉及到您的錯誤,但該錯誤代碼也可以運行,如果一個人在多個服務器上運行節點具有相同同時從他們的終端尋址。

73

檢查是否有其他終端在同一端口上運行其他應用程序。當多個應用程序試圖訪問相同的端口時,會發生這種情況,它始終是FIFO。

祝你好運!!!

+0

哦,是的,它解決了我的同樣的問題 – yussan

+0

它是什麼端口? – dmr

+2

它是你的本地端口,如果localhost:\\ 3000已經啓動並運行,你不能在同一個端口上運行另一個應用程序。你會得到上述錯誤。 –

0

你是否安裝了imagemagick?

brew install imagemagick 
11

先查看其他應用程序運行在同一個端口上可能是另一個節點應用程序。

要找到相同的端口使用當前運行的進程:

MAC:

你可以試試netstat的

netstat -anp tcp | grep 3000 

對於OSX 「酋長」,或者如果你的netstat不支持-p,使用lsof

lsof -i tcp:3000 

然後殺死進程

kill pid 

您可以嘗試殺死所有節點過程中使用:

killall -9 node 
0

我在工作中同樣的錯誤在我的Mac Pro的預訂。沒有解決方案修復它。我終於通過重新啓動計算機來解決問題。我經常不會在晚上關閉計算機並將其置於睡眠模式,因此如果您的計算機運行了很長時間,請嘗試重新啓動計算機,看看它是否適用於您。

0

所以它拋出一個錯誤,未處理的錯誤事件,這意味着你需要處理錯誤事件,在這個事件上添加函數並打印錯誤,你會發現原因和你的程序將正常工作。

相關問題