nielsenramon / chalk

Chalk is a high quality, completely customizable, performant and 100% free Jekyll blog theme.
http://chalk.nielsenramon.com
MIT License
1.23k stars 442 forks source link

jekyll 3.8.6 | Error: wrong number of arguments (given 2, expected 1) #195

Closed sudhiry closed 4 years ago

sudhiry commented 5 years ago

I am getting below error:

$ npm run local

> chalk@ local /Users/<user>/Documents/projects/blog/chalk
> bundle exec jekyll serve --drafts

Configuration file: /Users/<user>/Documents/projects/blog/chalk/_config.yml
            Source: /Users/<user>/Documents/projects/blog/chalk
       Destination: /Users/<user>/Documents/projects/blog/chalk/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
jekyll 3.8.6 | Error:  wrong number of arguments (given 2, expected 1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chalk@ local: `bundle exec jekyll serve --drafts`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the chalk@ local script.

Trace logs:

ArgumentError: wrong number of arguments (given 2, expected 1)
  /Users/<user>/.rvm/gems/ruby-2.6.3/gems/jekyll-assets-3.0.12/lib/jekyll/assets/manifest.rb:58:in `find_directory_manifest'
  /Users/<user>/.rvm/gems/ruby-2.6.3/gems/sprockets-4.0.0/lib/sprockets/manifest.rb:56:in `initialize'
  /Users/<user>/.rvm/gems/ruby-2.6.3/gems/jekyll-assets-3.0.12/lib/jekyll/assets/manifest.rb:29:in `initialize'
  /Users/<user>/.rvm/gems/ruby-2.6.3/gems/jekyll-assets-3.0.12/lib/jekyll/assets/env.rb:48:in `new'

Machine: MacOS Catalina.

Can you please help me to solve the issue?

jameshyen commented 5 years ago

Getting a similar error on both my Windows machine, and macOS. It seems very Ruby-specific. Any attempt I make at fixing the issue, either by updating Gems, or elevating permissions, seems to fail to circumvent it. Anyone got an idea on what it might be?

jameshyen commented 5 years ago

So if you enter the Gemfile and remove the 3.8.6 requirement from Jekyll, it will install 4.0.0, which is slightly more verbose about the error. The error will say that _includes/head.html fails to locate og-image.jpg. This can be remedied by adding _assets/images to sources in the _config.yml file. However, I am now getting an error that there are two incompatible character encodings in layouts/post.html: UTF-8 and ASCII-8BIT.

Edit: the above encoding error was just something specific to my setup. I was able to fix it my going through some of the Markdown and HTML files and making sure their line-endings were CR instead of LF. But I am now getting an error regarding inability to find some of the SVG icons. It seems like the error is Jekyll Assets/Liquid related.

cartjonye commented 5 years ago

I run bundle exec jekyll serve --trace and i found something that might be a root cause of the problem.

Traceback (most recent call last):
 ...
     3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-assets-3.0.12/lib/jekyll/assets/env.rb:48:in `new'
     2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-assets-3.0.12/lib/jekyll/assets/manifest.rb:29:in `initialize'
     1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sprockets-4.0.0/lib/sprockets/manifest.rb:56:in `initialize'
 C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/jekyll-assets-3.0.12/lib/jekyll/assets/manifest.rb:58:in `find_directory_manifest': wrong number of arguments (given 2, expected 1) (ArgumentError)

From the stacktrace it seems that the issue is sprockets 4.0.0 breaks recent version of jekyll-assets (3.0.12 as the writings).

I search for suggestions and comments regarding the issue and i found rgant's comment in https://github.com/envygeeks/jekyll-assets/issues/622, which is suggesting that forcing sprockets to earlier version in Gemfile might do the trick.

gem "sprockets", "~> 3.7"
jameshyen commented 5 years ago

@cartjonye confirmed, thank you. The above fix is working for me.