在离子2中运行离子服务时出现错误。

时间:2021-02-23 23:00:22

When I ran ionic serve in node.js command line or GitHub power shell, I encounter this error.

当我在node运行ionic服务时。js命令行或GitHub powershell,我遇到了这个错误。

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 ≡]>

Noted I could miss out node sass and gulp, and some windows user need visual studio, I follow this link How to compile or convert sass / scss to css with node-sass (no Ruby)? Using this command npm install --msvs_version=2013 gulp node-sass gulp-sass

注意,我可能会错过节点sass和gulp,而且有些windows用户需要visual studio,我遵循这个链接如何使用node-sass(没有Ruby)将sass / scss编译或转换为css ?使用此命令npm安装——msvs_version=2013 gulp节点-sass gulp

Now, I encounter this error.

现在,我遇到了这个错误。

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`?

all the version i sued are as below:

我起诉的所有版本如下:

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

2 个解决方案

#1


1  

Check that you have the latest gulp-sass version in package.json; It's a dependency of node-sass + required by Ionic, e.g.

检查您在package.json中有最新的gulp-sass版本。它是node-sass +的一个依赖关系,如Ionic所要求的。

"dependencies": {
    "gulp-sass": "^2.3.2"
  },

Uninstall gulp-sass

卸载gulp-sass

$ npm uninstall --save-dev gulp-sass

Reinstall gulp-sass

重新安装gulp-sass

$ npm install --save-dev gulp-sass@2

There are a large number of issues pertaining to node-sass installation.
You may have to rebuild node-sass: $ npm rebuild node-sass

与节点sass安装相关的问题有很多。您可能需要重新构建节点:$ npm重新构建节点

#2


-1  

This solution worked for me:

这个解决方案对我起了作用:

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

#1


1  

Check that you have the latest gulp-sass version in package.json; It's a dependency of node-sass + required by Ionic, e.g.

检查您在package.json中有最新的gulp-sass版本。它是node-sass +的一个依赖关系,如Ionic所要求的。

"dependencies": {
    "gulp-sass": "^2.3.2"
  },

Uninstall gulp-sass

卸载gulp-sass

$ npm uninstall --save-dev gulp-sass

Reinstall gulp-sass

重新安装gulp-sass

$ npm install --save-dev gulp-sass@2

There are a large number of issues pertaining to node-sass installation.
You may have to rebuild node-sass: $ npm rebuild node-sass

与节点sass安装相关的问题有很多。您可能需要重新构建节点:$ npm重新构建节点

#2


-1  

This solution worked for me:

这个解决方案对我起了作用:

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