Skip to main content

2 posts tagged with "docusaurus"

View All Tags

· 2 min read
Faycal Alami-Hassani
note

The following blog post is a self-reminder for troubleshooting Linux distros when access to graphical mode is not possible.

I recently messed up the SELinux configuration on a Fedora distro while trying to relabel the filesystem on boot with this command:

fixfiles -B onboot

After running the command and restarting the OS, the relabeling process was failing repeatedly, leading my system to an infinite reboot loop.

Fixing a messed-up SELinux configuration
Picture by the Electronic Frontier Foundation under CC BY 2.0 license

To fix this issue, I had to boot into text-only mode and change the SELinux mode temporarily from Enforced to Disabled.

Here are the steps to boot into text-only mode:

  1. Restart the system to access the GRUB menu.
  2. Select the kernel version that you want to boot into, then press the e key instead of Enter to edit the desired version.
  3. Scroll down until you reach the quiet parameter. Next, add a white space and number three 3 just after the quiet parameter (i.e., quiet 3). Here is a full example:
kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ acpi=on rhgb quiet 3
  1. Press Ctrl+X to start
  2. The system will boot into the new runlevel this time only.
info

A runlevel is a number indicating what "mode" you want the system to boot into. For instance, runlevel 3 is text-only mode, while runlevel 5 refers to graphical mode.

· 3 min read
Faycal Alami-Hassani

This is the first time that I am facing issues with unmet dependencies in Docusaurus after a Yarn Upgrade.

What is Docusaurus?

Docusaurus is an SSG (short for Static Site Generator). Static Site Generators are software frameworks that generate static HTML webpages using templates, components, and plain-text files.

The plain-text files make use of markup languages such as Markdown. Since there are neither databases nor dynamic content involved, the static HTML files load pretty fast.

There are many SSGs on the web to choose from. Docusaurus, Hugo, and Eleventy are just some of the most famous ones among them. It is up to you to select the brand that best suits your needs.

Docusaurus offers some very interesting features, including:

  • versioning capabilities
  • contextual and faceted navigation based on a integrated search engine
  • built-in support for the standard file format MDX, which allows you to embed the JavaScript extension syntax JSX into your Markdown

These and other features make it a great fit to create beautiful static documentation sites.

What is Yarn?

Yarn is a JavaScript package manager that was developed to address some shortcomings of its predecessor npm, the default package manager for Node.js.

Packages, Manifests, and Package Managers

Developers use packages to share their code. In addition to the actual code, each package contains a manifest file, also called package.json.

The manifest file describes the package itself using a lightweight data-interchange format called JSON (JavaScript Object Notation).

Here is an excerpt of a manifest:

{
"name": "@anycli/manifest-file",
"description": "base json file wrapper used inside anycli",
"version": "0.3.9",
"author": "Jeff Dickey @jdxcode",
"bugs": "https://github.com/anycli/manifest-file/issues",
"dependencies": {
"cli-ux": "^3.3.13",
"debug": "^3.1.0",
"fs-extra": "^5.0.0",
"load-json-file": "^4.0.0",
"lodash": "^4.17.4",
"proper-lockfile": "^3.0.2"
}

Source code available on GitHub under: oclif / manifest file

A package manager relies on the manifest to determine the properties of each specific package, e.g. name, version, and dependencies.

To avoid any future conflicting packages in your project, you are better advised to select a specific package manager right from the start and stick to it.

If you want to learn more about the differences between yarn and npm, I suggest you read the following article: npm vs. yarn: Which Package Manager Should You Choose?

Troubleshooting Yarn Upgrade in Docusaurus

Yesterday, I got a warning message prompting me to upgrade Yarn while I was testing Docusaurus on my local development environment.

After running the upgrade with the following command:

$ yarn upgrade @docusaurus/core@latest @docusaurus/preset-classic@latest

I got several warning messages regarding unmet peer dependencies:

$ warning "@docusaurus/core > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.0" has unmet peer dependency "typescript@>= 2.7".
$ warning "@docusaurus/preset-classic > @docusaurus/theme-search-algolia > @docsearch/react@3.0.0" has unmet peer dependency "@types/react@>= 16.8.0 < 18.0.0".

To resolve the issue, I had to install the latest versions of the following packages inside my project:

$ yarn add typescript@2.7.2
$ yarn add "@types/react@>= 16.8.0 < 18.0.0"

Once the installation has completed, I wanted to make sure that the problem was resolved, so I regenerated the content with the command:

$ yarn run build

Then I used the following command to test my build locally:

$ yarn run serve

That's it! Everything is working fine now ☀️.

Copyright © GlobalTech Translations 2022.