Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: File to import not found or unreadable: normalize. #1197

Closed
Yasachandra opened this issue Feb 6, 2020 · 15 comments
Closed

Error: File to import not found or unreadable: normalize. #1197

Yasachandra opened this issue Feb 6, 2020 · 15 comments

Comments

@Yasachandra
Copy link

I have taken the slate from github on 5-Feb-2020.
I have installed Ruby and i did "middleman build --verbose"
The build fails by giving following:
There were errors during this build
When i check the verbose logs I get the following:
error build/stylesheets/print-9e216c34.css
Error: File to import not found or unreadable: normalize.
on line 2:1 of stdin

@import 'normalize';

^
and
error build/stylesheets/screen-0807b593.css
Error: File to import not found or unreadable: normalize.
on line 2:1 of stdin

@import 'normalize';

^
Now when i try "bundle middleman exec server" and check localhost port 4567, the css is all messed up. See sceenshot attached.
screenshot

@Yasachandra
Copy link
Author

I re-installed Ruby in another machine which had less restrictions on running bash scripts that were being blocked on my previous machine's antivirus software on giving the command "ridk install". This project works fine in my new machine.

@MikeRalphson
Copy link
Contributor

Thanks, maybe this will help other people.

@pinheadmz
Copy link

pinheadmz commented May 28, 2020

Having this issue on OSX before and after upgrading Ruby.

@Yasachandra can you explain a bit more about the restricitons on bash scripts?

tried

$ ruby --version
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]

and

$ ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]

@MasterOdin
Copy link
Member

what is the output from running bundle exec middleman build?

@pinheadmz
Copy link

pinheadmz commented May 28, 2020

Yes, thanks.

Oh sorry I thought you said "was the output from..."

       error  ../../api-docs/stylesheets/screen.css
Error: File to import not found or unreadable: normalize.
        on line 2:1 of stdin
>> @import 'normalize';

   ^

stdin:2
/Users/matthewzipkin/.rvm/gems/ruby-2.7.1/gems/sassc-2.3.0/lib/sassc/engine.rb:50:in `render'
/Users/matthewzipkin/.rvm/gems/ruby-2.7.1/gems/middleman-core-4.3.7/lib/middleman-core/extensions/minify_css.rb:31:in `compress'
/Users/matthewzipkin/.rvm/gems/ruby-2.7.1/gems/middleman-core-4.3.7/lib/middleman-core/extensions/minify_css.rb:114:in `minify'
/Users/matthewzipkin/.rvm/gems/ruby-2.7.1/gems/memoist-0.16.2/lib/memoist.rb:213:in `minify'
/Users/matthewzipkin/.rvm/gems/ruby-2.7.1/gems/middleman-core-4.3.7/lib/middleman-core/extensions/minify_css.rb:73:in `call'
/Users/matthewzipkin/.rvm/gems/ruby-2.7.1/gems/middleman-autoprefixer-2.7.1/lib/middleman-autoprefixer/extension.rb:48:in `call'
/Users/matthewzipkin/.rvm/gems/ruby-2.7.1/gems/middleman-core-4.3.7/lib/middleman-core/core_extensions/inline_url_rewriter.rb:74:in `call'
/Users/matthewzipkin/.rvm/gems/ruby-2.7.1/gems/rack-2.2.2/lib/rack/head.rb:12:in `call'
...
..
.

@MasterOdin
Copy link
Member

I'd like to see the full command, with a focus on the first few lines:

$ bundle exec middleman build
== Sprockets will render css with ruby sass
   consider using Sprockets 4.x to render with SassC
...

I believe that Sprocket is using sassc here and that's the start of the errors, but I'd like to confirm that first. I'd also like to know if you used bundle install to install the dependency gems for running slate.

@pinheadmz
Copy link

pinheadmz commented May 28, 2020

Sorry about the "obsolete" warnings, I read elsewhere thats a ruby 2.7 issue

Yeah, bundle install first.

$ bundle exec middleman build
== Sprockets will render css with SassC
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/builder.rb:232: warning: URI.escape is obsolete
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/builder.rb:232: warning: URI.escape is obsolete
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/rack.rb:89: warning: URI.unescape is obsolete
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/util/paths.rb:36: warning: URI.unescape is obsolete
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/util/paths.rb:36: warning: URI.unescape is obsolete
       error  build/stylesheets/print.css
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/rack.rb:89: warning: URI.unescape is obsolete
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/util/paths.rb:36: warning: URI.unescape is obsolete
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/util/paths.rb:36: warning: URI.unescape is obsolete
       error  build/stylesheets/screen.css
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/builder.rb:232: warning: URI.escape is obsolete
/usr/local/lib/ruby/gems/2.7.0/gems/middleman-core-4.3.7/lib/middleman-core/builder.rb:232: warning: URI.escape is obsolete
      create  build/images/navbar.png
      create  build/images/logo.png
      create  build/fonts/slate.woff
      create  build/images/favicon.ico
      create  build/fonts/slate.woff2
      create  build/fonts/slate.ttf
/usr/local/lib/ruby/gems/2.7.0/gems/mid

@pinheadmz
Copy link

If it's any help, this error came up only after upgrading middleman from 4.2.1 to 4.3.7 because of a security warning:

middleman/middleman#2326

@MasterOdin
Copy link
Member

MasterOdin commented May 28, 2020

Can you post here the contents of your Gemfile and Gemfile.lock files?

@pinheadmz
Copy link

repo is here:

https://github.com/handshake-org/handshake-org.github.io/tree/master/src/api-docs

Appreciate your time! thank you

ruby '>=2.3.1'
source 'https://rubygems.org'

# Middleman
gem 'middleman', '~>4.3.7'
gem 'middleman-syntax', '~> 3.0.0'
gem 'middleman-autoprefixer', '~> 2.7.0'
gem 'middleman-livereload'
gem 'middleman-sprockets', '~> 4.1.0'
gem 'rouge', '~> 2.0.5'
gem 'redcarpet', '~> 3.4.0'
gem 'nokogiri', '>= 1.8.5'
gem 'rack', '>= 2.0.6'

GEM
  remote: https://rubygems.org/
  specs:
    activesupport (5.2.4.3)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    autoprefixer-rails (6.7.7.2)
      execjs
    backports (3.17.2)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.1.6)
    contracts (0.13.0)
    dotenv (2.7.5)
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    erubis (2.7.0)
    eventmachine (1.2.7)
    execjs (2.7.0)
    fast_blank (1.0.0)
    fastimage (2.1.7)
    ffi (1.12.2)
    haml (5.1.2)
      temple (>= 0.8.0)
      tilt
    hamster (3.0.0)
      concurrent-ruby (~> 1.0)
    hashie (3.6.0)
    http_parser.rb (0.6.0)
    i18n (0.9.5)
      concurrent-ruby (~> 1.0)
    kramdown (1.17.0)
    listen (3.0.8)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    memoist (0.16.2)
    middleman (4.3.7)
      coffee-script (~> 2.2)
      haml (>= 4.0.5)
      kramdown (~> 1.2)
      middleman-cli (= 4.3.7)
      middleman-core (= 4.3.7)
    middleman-autoprefixer (2.7.1)
      autoprefixer-rails (>= 6.5.2, < 7.0.0)
      middleman-core (>= 3.3.3)
    middleman-cli (4.3.7)
      thor (>= 0.17.0, < 2.0)
    middleman-core (4.3.7)
      activesupport (>= 4.2, < 6.0)
      addressable (~> 2.3)
      backports (~> 3.6)
      bundler
      contracts (~> 0.13.0)
      dotenv
      erubis
      execjs (~> 2.0)
      fast_blank
      fastimage (~> 2.0)
      hamster (~> 3.0)
      hashie (~> 3.4)
      i18n (~> 0.9.0)
      listen (~> 3.0.0)
      memoist (~> 0.14)
      padrino-helpers (~> 0.13.0)
      parallel
      rack (>= 1.4.5, < 3)
      sassc (~> 2.0)
      servolux
      tilt (~> 2.0.9)
      uglifier (~> 3.0)
    middleman-livereload (3.4.6)
      em-websocket (~> 0.5.1)
      middleman-core (>= 3.3)
      rack-livereload (~> 0.3.15)
    middleman-sprockets (4.1.1)
      middleman-core (~> 4.0)
      sprockets (>= 3.0)
    middleman-syntax (3.0.0)
      middleman-core (>= 3.2)
      rouge (~> 2.0)
    mini_portile2 (2.4.0)
    minitest (5.14.1)
    nokogiri (1.10.9)
      mini_portile2 (~> 2.4.0)
    padrino-helpers (0.13.3.4)
      i18n (~> 0.6, >= 0.6.7)
      padrino-support (= 0.13.3.4)
      tilt (>= 1.4.1, < 3)
    padrino-support (0.13.3.4)
      activesupport (>= 3.1)
    parallel (1.19.1)
    public_suffix (4.0.5)
    rack (2.2.2)
    rack-livereload (0.3.17)
      rack
    rb-fsevent (0.10.4)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    redcarpet (3.4.0)
    rouge (2.0.7)
    sassc (2.3.0)
      ffi (~> 1.9)
    servolux (0.13.0)
    sprockets (4.0.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    temple (0.8.2)
    thor (1.0.1)
    thread_safe (0.3.6)
    tilt (2.0.10)
    tzinfo (1.2.7)
      thread_safe (~> 0.1)
    uglifier (3.2.0)
      execjs (>= 0.3.0, < 3)

PLATFORMS
  ruby

DEPENDENCIES
  middleman (~> 4.3.7)
  middleman-autoprefixer (~> 2.7.0)
  middleman-livereload
  middleman-sprockets (~> 4.1.0)
  middleman-syntax (~> 3.0.0)
  nokogiri (>= 1.8.5)
  rack (>= 2.0.6)
  redcarpet (~> 3.4.0)
  rouge (~> 2.0.5)

RUBY VERSION
   ruby 2.6.6p146

BUNDLED WITH
   1.17.2

@MasterOdin
Copy link
Member

If you first do bundle add sass and then re-run the build, does that fix it for you? Unfortunately, while sassc is billed as a drop-in replacement for sass, it is not really the case, and we have to explicitly make sure it's included.

@pinheadmz
Copy link

Hmmmmm that wasnt it either...

$ bundle add sass
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
...
Using redcarpet 3.4.0
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.7.4
Installing sass 3.7.4

$ bundle exec middleman build 
== Sprockets will render css with SassC
       error  build/stylesheets/screen.css
       error  build/stylesheets/print.css

@MasterOdin
Copy link
Member

Sorry, I'm not totally sure on how the Ruby ecosystem functions (I primarily work in Python, Node, and PHP), but I guess that you've got sassc installed elsewhere and middleman-sprockets 4 will prefer it over sass if it's at all available (even if not specified for your project.

Do you require a specific feature of sprockets 4, or would downgrading to gem 'sprockets', '~> 3.7' be possible? It's the version that slate itself uses, one of the reasons is to avoid the sass / sassc issue (as only sprockets >= 4 can use it).

@pinheadmz
Copy link

@MasterOdin thank you! This turned to be the solution for me.

Made the change here: pinheadmz/handshake-org.github.io@e019cc5

Also required turning off activate: sprockets in the middleman config.rb file.

cheers!
🏆 🍺 🌞

@channainfo
Copy link

Sorry, I'm not totally sure on how the Ruby ecosystem functions (I primarily work in Python, Node, and PHP), but I guess that you've got sassc installed elsewhere and middleman-sprockets 4 will prefer it over sass if it's at all available (even if not specified for your project.

Do you require a specific feature of sprockets 4, or would downgrading to gem 'sprockets', '~> 3.7' be possible? It's the version that slate itself uses, one of the reasons is to avoid the sass / sassc issue (as only sprockets >= 4 can use it).

explicitly adding gem 'sprockets', '~> 3.7' to the Gemfile works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants