I encountered an error when I executed the command "ionic serve"


#1

Hi guys
when i start a server , return me this:

Running ‘build:before’ gulp task before build
[08:02:48] Starting ‘clean’…
[08:02:48] Finished ‘clean’ after 25 ms
[08:02:48] Starting ‘build’…
[08:02:48] Starting ‘sass’…
[08:02:48] Starting ‘html’…
[08:02:48] Starting ‘fonts’…
[08:02:48] Starting ‘scripts’…
node_modules\ionic-angular\components.core.scss
Error: Import directives may not be used within control directives or mixins.
on line 34 of node_modules/ionic-angular/components.core.scss

@import “fonts/ionicons”;
–^

[08:02:48] Finished ‘sass’ after 124 ms
[08:02:48] Finished ‘html’ after 114 ms
[08:02:48] Finished ‘scripts’ after 139 ms
[08:02:48] Finished ‘fonts’ after 195 ms
[08:03:04] Finished ‘build’ after 16 s
[08:03:04] Starting ‘build:before’…
[08:03:04] Finished ‘build:before’ after 14 μs

then i found ionic-angular/components.core.sass , and comment the line @if

// Ionicons (to be replaced with SVGs)
$ionicons: true !default;
//@if ($ionicons) {
@import “fonts/ionicons”;
//}

restart serve , isok

how do i fix???

ionic info

Your system information:

Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.4
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS:
Node Version: v4.4.2

node-sass


#2

I’m receiving this error as well after starting a new project based off of the tutorial (i.e. ionic start MyIonicTutorial tutorial --v2.

I was able to comment out the same code to get this passing like the post above, but then I get another one:

node_modules/ionic-angular/components/tabs/tabs.wp.scss
Error: Undefined variable: "$color-contrast".
        on line 88 of node_modules/ionic-angular/components/tabs/tabs.wp.scss
>>       color: $color-contrast;

At this point the project does get served up, but the styles are not correct because all of the scss files are not compiling successfully.

Ionic Info:

Cordova CLI: 6.1.1
Ionic Framework Version: 2.0.0-beta.4
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v5.10.1
Xcode version: Xcode 7.3 Build version 7D175

Any help would be appreciated. The github repo for the tutorial does not have issues enabled, so I cannot file one there. Let me know if I need to file this as an issue in the core ionic repo.


#3

same error on my code , but the scss files is compiled success , except WP …

how do i fix it ???


#4

yes the same error on my code.
$ ionic start --ts tutorial --v2

i’m using ionic cli 2.0.0-beta.25

ionic info:
Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.4
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS
Node Version: v4.4.3


#5

If u still have problem:

Install new ionic 2 version with: ionic start … --v2
Copy your “app” folder into this new one.

Profit :slight_smile:

After that output the same problem?


#6

Have a look at my quick-fix reply here: http://stackoverflow.com/a/36765721/429719


#7

I am seeing the same errors.


#8

Same issue for me, any suggestion how to solve this issue without changing files under node-modules folder?


#9

There’s already an open issue about this (there’s also a workaround in the comments):