2017-04-07 55 views
1

我正在使用nvm在節點版本之間進行切換。節點Sass缺少多個節點版本的綁定

我的package.json:

"scripts": { "dev": "rm -rf public/assets/*.hot-update.js && NODE_ENV=development webpack --env=dev --progress --profile --colors", "prod": "NODE_ENV=production webpack --env=prod --progress --profile --colors" }, "author": "", "license": "ISC", "devDependencies": { "babel-core": "^6.18.2", "babel-loader": "^6.2.10", "babel-preset-es2015": "^6.18.0", "babel-preset-stage-0": "^6.16.0", "babel-preset-stage-2": "^6.18.0", "compression-webpack-plugin": "^0.3.2", "css-loader": "^0.26.2", "extract-text-webpack-plugin": "^2.0.0", "file-loader": "v0.10.0", "imports-loader": "^0.7.0", "node-sass": "^4.1.1", "postcss-cssnext": "^2.9.0", "sass-loader": "^4.1.1", "script-loader": "^0.7.0", "style-loader": "^0.13.1", "uglifyjs-webpack-plugin": "^0.1.2", "vue": "^2.0.3", "vue-lazyload": "0.7.5", "vue-loader": "^10.2.1", "vue-resource": "^1.2.0", "vue-style-loader": "^1.0.0", "vue-template-compiler": "^2.1.8", "vuex": "^2.0.0", "webpack": "2.2.0", "webpack-manifest-plugin": "^1.1.0", "webpack-md5-hash": "^0.0.5", "webpack-merge": "^2.6.1", "whatwg-fetch": "^2.0.2" }

當我使用節點V6.2.0,並運行npm run dev,我得到以下錯誤:

ERROR in ./~/css-loader?{"minimize":true}!./~/vue-loader/lib/style-rewriter.js?id=data-v-be2abeee!./~/sass-loader!./~/vue-loader/lib/selector.js?type=styles&index=0!./~/@zoomcarindia/web-zap-revenue-calculator/src/components/graph/graph.vue 
    Module build failed: Error: Missing binding /Users/nihar/Documents/zoomcar/web/node_modules/node-sass/vendor/darwin-x64-48/binding.node 
    Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 6.x 

Found bindings for the following environments: 
    - OS X 64-bit with Node.js 7.x 

,當我使用節點V7 .8.0,我得到以下錯誤:

ERROR in ./checklist/~/css-loader?{"minimize":true}!./~/vue-loader/lib/style-rewriter.js?id=data-v-a5234466!./checklist/~/sass-loader!./~/vue-loader/lib/selector.js?type=styles&index=0!./checklist/src/components/Upload.vue 
    Module build failed: Error: Missing binding /Users/nihar/Documents/zoomcar/web/checklist/node_modules/node-sass/vendor/darwin-x64-51/binding.node 
    Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 7.x 

    Found bindings for the following environments: 
     - Unknown environment (.DS_Store) 
     - OS X 64-bit with Node.js 6.x 

無論哪個點頭我使用的版本,它說相應的綁定丟失。

我試過npm rebuild node-sassrm -rf node_modules多次。

即使嘗試npm install --save-dev [email protected]建議here

最初我使用brew安裝了節點。那是v6.2.0。我完全按照建議here刪除了system節點,然後使用nvm安裝了相同的節點。

但問題仍然存在。請讓我知道我在這裏失蹤。

+0

你試過'npm rebuild node-sass --force'嗎? – robertklep

+0

剛剛嘗試過,沒有工作。 –

+0

我可以重現這個問題,但爲我解決了這個問題。 – robertklep

回答

0

所以我有一個類似的問題,節點sass剛剛結束抓住我需要從github here二進制文件。

對我而言,我需要win32-ia32-48,所以我創建了該文件夾並從上面的鏈接(在重命名它以刪除win32-ia32-48前綴後)複製到binding.node文件中。

0

npm rebuild node-sass曾效力於VS 2017,但不適用VS碼。我必須在運行VS Code之前運行npm cache clean。我沒有嘗試npm rebuild node-sass --force,因爲我在找到這個頁面之前解決了它,所以我不知道這是否會產生相同的效果。

1

後的戰鬥構建系統的時間,我放棄了,類似馬特上面,我只是抓住了二進制從https://github.com/sass/node-sass/releases

(Matt的鏈接並沒有上升到節點9)

我創建的目錄運行webapp(在我的情況下是Webstorm)說,它正在尋找缺少的二進制文件,下載了二進制文件,並在我的情況下將darwin-x64-59_binding.node重命名爲binding.node並嘗試再次運行 - 然後運行。