Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dart SassBuilder cannot find Logger

I am trying to run an angular web app. I have cloned confirmed working project, but when I run pub get I get following error:

/usr/lib/dart/bin/pub get
Resolving dependencies...
Got dependencies!
Precompiling dependencies...
Loading source assets...
Loading angular, sass_builder and dart_to_js_script_rewriter transformers...
Error on line 26, column 5 of ../../.pub-cache/hosted/pub.dartlang.org/angular_components-0.8.0/pubspec.yaml: Error loading transformer: 'package:sass_builder/sass_builder.dart': malformed type: line 34 pos 20: cannot resolve class 'Logger' from 'SassBuilder'
  final _log = new Logger('sass_builder');
                   ^


    outputExtension: .scss.css
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Process finished with exit code 0

My pub.yaml:

name: ZwinnexD
description: A web app that is a web app
version: 0.21.37
#homepage: https://www.example.com
#author: Kod Schrödingera <[email protected]>

environment:
  sdk: '>=1.24.0 <2.0.0'

dependencies:
  angular: ^4.0.0
  angular_components: ^0.8.0
  firebase: ^4.0.0

dev_dependencies:
  angular_test: ^1.0.0
  browser: ^0.10.0
  dart_to_js_script_rewriter: ^1.0.1
  test: ^0.12.0

transformers:
- angular:
    entry_points:
      - web/main.dart
      - test/**_test.dart
- test/pub_serve:
    $include: test/**_test.dart
- dart_to_js_script_rewriter

# Uncomment the following in sdk 1.24+ to make pub serve
# use dartdevc (webdev.dartlang.org/tools/dartdevc).
#web:
#  compiler:
#    debug: dartdevc

I am using dart 1.24.3.
I have tried removing pub-cache, doing cache repair, even reinstalling Dart. Nothing helps. I work on Ubuntu 16.04. Please help.

I can also confirm that basic projects from WebStorm don't work either. I am not sure what can I do beside uninstalling and installing dart...

like image 991
Marcin Szałek Avatar asked Mar 17 '18 09:03

Marcin Szałek


2 Answers

So far I have figured out that editing SassBuilder class in pub-cache fixes the issue. You just need to change import of logger from this

import 'package:logging/logging.dart';

to this:

import 'package:logging/logging.dart' as Log;

and also change logger constructor from this:

final _log = new Logger('sass_builder');

to this:

final _log = new Log.Logger('sass_builder');

I have no idea for better solution right now.

like image 135
Marcin Szałek Avatar answered Sep 21 '22 15:09

Marcin Szałek


It was issue in sass-builder. To fix it, use sass_builder: ^1.1.5 or above in pubspec.yaml. Here is pull request with fix.

like image 24
Zufar Muhamadeev Avatar answered Sep 22 '22 15:09

Zufar Muhamadeev