Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: File to import not found or unreadable: globals.core

Tags:

ionic2

I am using Ionic 2.

I am getting an error when I run:

ionic build android
Running 'build:before' gulp task before build
[15:35:59] Starting 'clean'...
[15:35:59] Finished 'clean' after 69 ms
[15:35:59] Starting 'build'...
[15:35:59] Starting 'sass'...
[15:35:59] Starting 'html'...
[15:35:59] Starting 'fonts'...
[15:35:59] Starting 'scripts'...
app\theme\app.variables.scss
Error: File to import not found or unreadable: globals.core
       Parent style sheet: E:/Development/IDE/ionic-apps/theWhoZoo/app/theme/app.variables.scss
        on line 7 of app/theme/app.variables.scss
>> @import "globals.core";

This a a file Ionic generated:

app.variables.scss

// http://ionicframework.com/docs/v2/theming/

// Ionic Shared Functions
// --------------------------------------------------
// Makes Ionic Sass functions available to your App

@import "globals.core";

// App Shared Variables
.
.

Any help is much appreciated.

like image 559
Richard Avatar asked Apr 18 '26 18:04

Richard


1 Answers

Update

This happens when trying to use the v2 of ionic-native in your package.json. It took me some searching, but it is apparently normal since a lot changes with RC0 version of Ionic2. Read all about the new structure here.

Steps to mitigate the issue and truly convert your app to the latest Ionic2 structure:

  1. Install node.js v6 from website
  2. Check npm version (3.x) (npm -v)
  3. Check ionic version (2.1.x) (ionic -v)
  4. kill nodejs instances
  5. remove node_modules folder
  6. Follow all steps as described in the Github changelog and:

    • For step 28, don't reuse your variables.scss file but take the one from the app base
    • For step 29, don't copy the app.*.scss files but remove them
    • Not described but useful: copy the tslint.json from the appbase, as this will valdiate your code with lint
  7. When all steps done, you can build your code with npm run build

Other errors I got:

  • [Error: Cannot determine the module for component xxx] => resolution
  • [Error: Compilation failed. Resource file not found] => resolution: templateUrl should be relative urls, eg templateUrl: 'build/pages/list/list.html' => templateUrl: 'list.html'
  • [TS2307: Cannot find module './app.module.ngfactory'] => resolution: execute "node_modules/.bin/ngc" - app, this will generate needed ts files in src/app/

Visual Studio

I'm using Visual Studio, to make the build work you'll have to close VS once again and reopen and it will work fine. Also note that you'll need to add the path 'C:\Program Files (x86)\nodejs' to your external web tools at the top, so it won't take the builtin node.js which is too old.

like image 164
S. Roose Avatar answered Apr 21 '26 07:04

S. Roose



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!