当我在node.js命令行或GitHub power shell中运行离子服务时,我遇到了这个错误。
There is an error in your gulpfile:
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
at getBinding (D:\GitHub\stockMarketApp\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:22:11)
at Object.<anonymous> (D:\GitHub\stockMarketApp\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:188:23)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\GitHub\stockMarketApp\node_modules\gulp-sass\index.js:3:17)
at Module._compile (module.js:413:34)
D:\GitHub\stockMarketApp [master ≡]>
注意我可能错过了节点sass和gulp,而且有些windows用户需要visual studio,我按照这个链接How to compile or convert sass / scss to css with node-sass (no Ruby)?
使用此命令npm install --msvs_version=2013 gulp node-sass gulp-sass
现在,我遇到了这个错误。
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]> ionic serve
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'vinyl'
Do you need to run `npm install`?
我起诉的所有版本如下:
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]> npm -v
3.9.0
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]> node -v
v5.11.1
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]> gulp -v
[17:09:03] CLI version 3.9.1
[17:09:03] Local version 3.9.0
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]> node-sass -v
node-sass 3.7.0 (Wrapper) [JavaScript]
libsass 3.3.6 (Sass Compiler) [C/C++]
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]> cordova -v
6.1.1
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]> ionic -v
2.0.0-beta.25
答案 0 :(得分:1)
检查gulp-sass
中是否有最新的package.json
版本;它是Ionic所需的node-sass +的依赖,例如
"dependencies": {
"gulp-sass": "^2.3.2"
},
卸载gulp-sass
$ npm uninstall --save-dev gulp-sass
重新安装gulp-sass
$ npm install --save-dev gulp-sass@2
有很多与node-sass安装有关的问题
您可能必须重建node-sass:$ npm rebuild node-sass
答案 1 :(得分:-1)
这个解决方案对我有用:
Uninstall gulp-sass
$ npm uninstall --save-dev gulp-sass
Reinstall gulp-sass
$ npm install --save-dev gulp-sass@2
$ npm install bower
$ionic serve --lab