2016-11-28 28 views
2

打開Visual Studio任務運行資源管理器時,gulpfile.js未能加載,並且在輸出窗口中發出此錯誤。VS任務運行資源管理器 - 節點Sass找不到綁定

Failed to run "C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\Gulpfile.js"... 
cmd.exe /c gulp --tasks-simple 
C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\node-sass\lib\binding.js:15 
     throw new Error(errors.missingBinary()); 
    ^
Error: Missing binding C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\node-sass\vendor\win32-ia32-47\binding.node 
Node Sass could not find a binding for your current environment: Windows 32-bit with Node.js 5.x 
Found bindings for the following environments: 
    - Windows 64-bit with Node.js 6.x 
This usually happens because your environment has changed since running `npm install`. 
Run `npm rebuild node-sass` to build the binding for your current environment. 
    at module.exports (C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\node-sass\lib\binding.js:15:13) 
    at Object.<anonymous> (C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\node-sass\lib\index.js:14:35) 
    at Module._compile (module.js:397:26) 
    at Object.Module._extensions..js (module.js:404:10) 
    at Module.load (module.js:343:32) 
    at Function.Module._load (module.js:300:12) 
    at Module.require (module.js:353:17) 
    at require (internal/module.js:12:17) 
    at Object.<anonymous> (C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\gulp-sass\index.js:187:21) 
    at Module._compile (module.js:397:26) 

運行gulp運行的任務和我的SASS編譯罰款。

我嘗試重新安裝節點,我也保證只有一個npm運行的是Windows路徑和我已經刪除了node_modules夾,然後運行npm install了幾次,也試過npm rebuild node-sass

所有這些數以百萬計的新型前端工具和庫似乎都極大地拓寬了「出錯的地方」,與以前的項目相比,效率並不高。

Luke

+0

說來慚愧,我放棄了,又回到了ASP.NET MVC 5: -/ –

回答

5

配置VS使用較新版本的節點。從指令由Ryan海耶斯

相關指示Synchronize Node.JS Install Version with Visual Studio 2015

片段是在以下情況下,鏈路狀態變爲陳舊。

我更新的Node.js的Visual Studio之外,但由於VS使用它自己的安裝是從任何外部安裝獨立的,你有可能碰到node_modules包的依賴問題,即NPM的一個版本安裝包(這使得它依賴於該版本的Node/npm),然後你不能在另一個版本中運行命令(它們會中斷)。具體來說,我遇到了node-sass和windows綁定的問題。解決方案是將Visual Studio指向我已經在Visual Studio外部設置的Node.JS版本。

  1. 首先,找到您已有的Node.js安裝並在命令行中使用。

我曾在C:\Program Files (x86)\nodejs\安裝的NodeJS。

  • 轉到工具>選項在Visual Studio 2015年
  • 在這個對話框中,轉到項目和解決方案>外部Web工具打開對話框,管理VS中使用的所有第三方工具。這是Node.js指向的地方。
  • 在頂部添加一個條目到node.js目錄的路徑,以強制Visual Studio使用該版本。 enter image description here
  • +0

    如果任何人可以保證這個答案請評論,我會接受。 –

    +1

    @LukePuplett我剛遇到這個問題,這個答案確實有效。 – Tom

    相關問題