Jekyll Build Not Working after MacOS High Sierra Update - ruby

Not sure if this is a bug, but I wasn’t able to find anything on the Web. Everything was working fine using a combination of Grunt, Jekyll and Homebrew to create my website. But once I updated to High Sierra the Jekyll build fails.
The way I usually run Jekyll build is via grunt-shell task like so:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
jekyllBuild: {
command: 'jekyll build'
}
},
connect: {
server: {
options: {
hostname: 'localhost',
port: 4000,
base: '_build'
}
}
},
...
watch: {
jekyll: {
options: {
livereload: true
},
files: [
'**/*.scss',
'**/*.html',
'**/*.js',
// The negations must go after
'!*node_modules/**',
'!*_build/**',
'*.md',
'*.yml',
'img/**',
],
tasks: ['shell:jekyllBuild','postcss']
}
}
});
...
grunt.registerTask('serve', ['shell','connect','watch']);
Which gives the following error:
Running "shell:jekyllBuild" (shell) task
Configuration file: [URL]/_config.yml
Source: [URL]
Destination: _build
Incremental build: disabled. Enable with --incremental
Generating...
jekyll 3.6.0 | Error: negative argument
Warning: Command failed: jekyll build
Use --force to continue.
Aborted due to warnings.
Everything else I run works except Jekyll.
I also tried just running jekyll build without shell task but still got an error:
jekyll 3.6.0 | Error: negative argument
Warning: Command failed: jekyll build
Use --force to continue.
Aborted due to warnings.
I am using Homebrew to keep things local and everything seems to be in the correct location:
~$ which jekyll
/usr/local/bin/jekyll
~$ which ruby
/usr/local/bin/ruby
~$ which grunt
[URL]/.npm-packages/bin/grunt
~$ which gem
/usr/local/bin/gem
~$ which node
/usr/local/bin/node
I realize, my setup may not be the best, but it was working so I'm hoping for some guidance. I was not the one to initially create this setup and I'm not a programmer but rather a web designer who can hack things together to my own detriment at times :)

The issue ended up not being related to OS update, but rather a custom Jekyll plugin that was causing the issue. Once the plugin was removed everything worked. However, something did change perhaps in Jekyll or elsewhere to make the plugin not work all of the sudden. I will open a separate issue to figure that out. Thanks #Casper and #JoostS for quick responses.

Related

ddev get drud/ddev-platformsh configuration - error when generating needed environment variables on MacOS

I'm encountering an issue with undefined project variables following the installation steps outlined here: https://github.com/drud/ddev-platformsh#install
Steps 1-3 were smooth, with no issues.
On step 4 ddev get drud/ddev-platformsh, the script runs successfully until the 'Executing post-install actions:' section. Here is the output with a few preceding lines for context:
Configuration complete. You may now run 'ddev start'.
Installing project-level components:
👍 web-build/Dockerfile.platformsh
👍 homeadditions/.bashrc.d/platformsh-environment.sh
👍 platformsh/.gitignore
👍 platformsh/generate_db_relationship.sh
👍 platformsh/generate_elasticsearch_relationship.sh
👍 platformsh/generate_memcached_relationship.sh
👍 platformsh/generate_redis_relationship.sh
Installing global components:
👍 commands/web/platform
Executing post-install actions:
👍 Support composer and python3 dependencies
BASE64_ENCODE=base64 -w 0
base64: illegal option -- w
base64: illegal option -- w
👎 Installing dependencies and generating needed environment variables
could not process post-install action (2) 'Installing dependencies and generating needed environment variables'
How do I address this? The issue could be that I'm running this on MacOS, which doesn't support the -w flag for BASE64 (based on this other SO issue).
Also, I see that Platform has these environment variables: https://docs.platform.sh/development/variables/use-variables.html#use-platformsh-provided-variables
...but I'm unclear how/where they should be integrated into the DDEV config files.
Also, after encountering the config error, I ran this command, which failed and further indicated that at least one project variable was missing:
$ ddev drush cr
In Config.php line 567:
The appDir variable is not defined. Are you sure you're running on Platform.sh?
Failed to run drush cr: exit status 1
Any advice wrt how to overcome this issue would be welcome. Thank you.
My environment:
DDEV: v1.21.4
OS: MacOS Ventura 13.1
CPU: Apple M1
I think you're on macOS and you have the homebrew version of base64 installed. Unfortunately, it's quite different in its behavior. Could you please uninstall the homebrew version? brew uninstall base64 && hash -r (hash -r just makes the changes in PATH immediately effective).
See https://github.com/drud/ddev-platformsh/issues/93

Golang linter issues 'context loading failed: no go files to analyze'

We are using
golangci-lint version 1.40.1 together with
golang version 1.16.4
in our project for linting our Golang code.
Until now, what we did is running this bash script (from the root
directory of our repository):
if ! [ -x "$(command -v golangci-lint)" ]; then
echo "Fetching linter..."
go install github.com/golangci/golangci-lint/cmd/golangci-lint
go mod tidy
fi
golangci-lint run --build-tags="unit contract container"
With some recent updates of Golang and golangci-lint, we suddenly face this error message:
ERRO Running error: context loading failed: no go files to analyze
There is a lengthy post on GitHub regarding this issue but the only useful suggestion there is to turn off the GO111MODULE env variable. When I run the linter with GO111MODULE turned off like
GO111MODULE=off golangci-lint run --build-tags="unit contract container"
the upper error message disappears but instead I am getting lots of false linting errors like:
api/router.go:152:5: undeclared name: `PermissionUpdatePackage` (typecheck)
PermissionUpdatePackage,
^
My go environment looks like this:
GO111MODULE=on
GOPATH=/Users/USER/workspace/go
GOROOT=/usr/local/opt/go/libexec
GOPRIVATE=*.CUSTOMER.com
GOSS_PATH=/usr/local/bin/goss
I tried to install the linter via go get... as well as go install ... and finally brew install golangci-lint which seems to be the recommended way following this documentation.
Running a go get ./... in the root of the project eventually solved the issues. In between we ran the following commands that probably cleared some (module?) caches that might have caused trouble as well:
golangci-lint cache clean && go clean -modcache -cache -i
golangci-lint run -v --timeout=5s
The error message
ERRO Running error: context loading failed: failed to load packages: timed out to load packages: context deadline exceeded
in the latter command pointed us to this GitHub post that made me try out go get ./...
For installing the linter (with a specified version), we ended up with this script:
linter_version='1.40.1'
if ! [ -x "$(command -v golangci-lint)" ]; then
echo "Fetching linter..."
# we cannot install linter in the project directory, otherwise we get dependency errors
# hence, temporarily jump into the /tmp directory
pushd /tmp > /dev/null
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint#v"${linter_version}" 2>&1
popd >/dev/null
fi

Bundle using old version of jekyll

I am trying to preview a site I have built in the past, using jekyll. Since then, I believe there have been updates to jekyll, and I now use zsh on MacOS 10.15.2. I'm having trouble now running a preview because it seems bundle keeps using an old version of jekyll.
When I run bundle exec jekyll server --unpublished I receive this error:
(base) ➜ angoodkind.github.io git:(master) ✗ bundle exec jekyll server --unpublished
Configuration file: /Users/adamg/Dropbox/Website/github_io/angoodkind.github.io/_config.yml
NOTE: Inheriting Faraday::Error::ClientError is deprecated; use Faraday::ClientError instead. It will be removed in or after version 1.0
Faraday::Error::ClientError.inherited called from /Users/adamg/Dropbox/Website/github_io/angoodkind.github.io/vendor/cache/ruby/2.6.0/gems/octokit-4.14.0/lib/octokit/middleware/follow_redirects.rb:14.
Source: /Users/adamg/Dropbox/Website/github_io/angoodkind.github.io
Destination: /Users/adamg/Dropbox/Website/github_io/angoodkind.github.io/_site
Incremental build: disabled. Enable with --incremental
Generating...
Error reading file /Users/adamg/Dropbox/Website/github_io/angoodkind.github.io/blog/index.html: (<unknown>): did not find expected key while parsing a block mapping at line 7 column 5
Error: could not read file /Users/adamg/Dropbox/Website/github_io/angoodkind.github.io/vendor/cache/ruby/2.6.0/gems/jekyll-3.5.2/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb: Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/cache/ruby/2.6.0/gems/jekyll-3.5.2/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/cache/ruby/2.6.0/gems/jekyll-3.5.2/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.
However, the system should be using jekyll 4.0.0, which was recently installed. Why is it using jekyll 3.5.2?

Jekyll serve error - jekyll 3.2.1 Error: File exists # syserr_fail2_in

I'm attempting to migrate a Jekyll site over to my local machine and was doing ok but I've run into an error I am struggling to find much information regarding. I am pretty new to the whole Jekyll thing so any help is much appreciated.
When I run bundle exec jekyll serve I get the following error:
$ bundle exec jekyll serve
Configuration file: /home/Documents/devsite/websites/marketing/_config.yml
Source: /home/Documents/devsite/websites/marketing
Destination: /home/Documents/devsite/websites/marketing/_site
Incremental build: disabled. Enable with --incremental
Generating...
Building site for default language: "en-gb" to: /home/Documents/devsite/websites/marketing/_site
jekyll 3.2.1 | Error: File exists # syserr_fail2_in - /home/Documents/devsite/websites/marketing/_site/favicon.ico
I'm unsure as to what this error relates to so I'm a little unsure as to where to go next. Thanks for any help.

Bad Exit Status from rpmbuild on Mac OSX

I'm working on packaging up some work into an rpm. I am doing this on Mac OSX after brew installing rpm. I have a basic .spec file, but I am getting an error and have been unable to diagnose it:
$ rpmbuild -ba myapp.spec
Executing(%prep): %{__spec_prep_cmd} /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.14478
error: Bad exit status from /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.14478 (%prep)
RPM build errors:
Bad exit status from /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.14478 (%prep)
The spec files is as follows:
Name: myapp
Version: 0.1.0
Release: 1
Summary: Web service to do stuff
URL: http://myapp.com
BuildRoot: %{_tmppath}/myapp-build-root
%description
My app
%prep
%build
%install
%pre
%preun
%postun
%clean
%files
%defattr(-,www-data,www-data,-)
%doc
This is my first time building an rpm, what am I doing wrong, and how can I fix this. Thanks in advance!
I ran into the same issue today. For no obvious reason the %prep macro fails, even without any content.
Running your spec on my Ubuntu box seems to work just fine after adding those two values:
License: yourLicense
Group: yourGroup
I have reason to believe, that rpm didn't get installed correctly on my box via homebrew. I think I aborted the process at some point, then forgot about it over lunch, but rpmbuild was available to use from within my script and I ran into the issue above.
I will try doing a clean install of the rpm formula in verbose mode to see whether my assumption is correct.
Update:
I've installed rpm successfully, but it took an awful long time:
/usr/local/Cellar/rpm/5.4.10: 187 files, 9.7M, built in 92.4 minutes
Nevertheless, it keeps on failing with the same error
rpmbuild -ba so.spec
Executing(%prep): %{__spec_prep_cmd} /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.69701
error: Bad exit status from /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.69701 (%prep)
With the content of /usr/local/Cellar/rpm/5.4.10/var/tmp/rpm-tmp.69701 saying:
%{__spec_prep_template}%{__spec_prep_post}

Resources