Skip to content

Troubleshoot common issues

Quick answers to the problems reported most often by real users, from the missing Vue template box to site-wide JSON:API 403 failures.

This page covers the issues that account for most of the confusion reported by real users over the life of this project. Each entry is a quick answer, with a link wherever a fuller explanation exists.

9 of 21 issues

Install and build

The build fails reaching the backend (ECONNREFUSED, timeouts, 400s) The build machine can't reach baseUrl. Test it with curl from there.

nuxt build and nuxt generate fetch schemas and content from Drupal from the machine running the build. A baseUrl that works in your browser can still be unreachable from the build: localhost inside a container is the container itself, a Docker hostname does not resolve outside its network, and a backend behind basic auth or a VPN blocks the build the same way. Confirm with curl <baseUrl>/jsonapi from the build environment. CI setups should wait for the backend to answer before starting the build. See Request topology.

Copy link
Build error: the pages directory is missing Create an empty pages/ directory.

Nuxt requires a pages/ directory even when Druxt's wildcard router provides every route. Create it with a placeholder: mkdir pages && touch pages/.gitkeep.

Copy link
Enabling the module fails with an undefined function error A drupal/druxt 1.3.0 bug. Upgrade to 1.3.1.

Call to undefined function druxt_resources() happens on drupal/druxt 1.3.0 when the module is added to a site that already has JSON:API enabled. The Extend form and drush pm:install load druxt.install without druxt.module, where 1.3.0 keeps the resource list. Upgrade:

composer require drupal/druxt:^1.3.1
drush cr
Copy link
Composer refuses to install drupal/druxt Allow the pre-release for that one package with a stability flag.

A stability error (minimum-stability) means a dependency's current release is below your project's floor. Allow the pre-release for that one package with a stability flag, as in composer require drupal/jsonapi_views:^1.1@beta, rather than lowering minimum-stability project-wide. See Prepare the Drupal backend.

Copy link
"This dependency was not found: druxt" after an npm install Druxt 0.25 needs axios 0.34.0 or later at the top level.

Druxt 0.25 needs axios 0.34.0 or later at the top level of your project. If npm installs an older axios there for @nuxtjs/axios, the Druxt packages can't share one copy of druxt. npm gives each package its own copy, and the build can't find druxt.

Check the tree in the Nuxt project (nuxt/ in the quickstart):

npm ls axios druxt

A healthy tree shows axios 0.34.0 or later at the top level, and one druxt, with every other entry for it marked deduped. If axios is older or missing, install it in the same folder:

npm install axios@^0.34.0

On Yarn 1, check with yarn list --pattern "axios|druxt". On Yarn 2 or later, use yarn why druxt and yarn why axios. yarn --version tells you which you have. A healthy tree has one druxt version, and axios 0.34.0 or later for your project. Fix it with yarn add axios@^0.34.0.

Copy link
"require() of ES Module axios" crash on a fresh install Fixed in Druxt 0.25.0. On older releases, pin or transpile axios.

On Druxt 0.25.0 and later this is fixed: the module transpiles axios. It needs axios 0.34.0 or later in your project, as the entry above explains. On earlier releases, Nuxt 2's webpack 4 resolves newer axios releases through their ESM entry, which the server, built as CommonJS, cannot load. Pin axios to a 0.x release (the compatibility table lists the known pins), or transpile it in nuxt.config.js:

export default {
  build: {
    transpile: ['axios'],
  },
};
Copy link
"error:0308010C:digital envelope routines" on Node 17 or later Build on Node 16, or turn on the OpenSSL legacy provider.

Node 17 moved to OpenSSL 3, which rejects the legacy hashing algorithms Nuxt 2's webpack 4 relies on. Either build on Node 16, or enable the legacy provider in the build environment:

NODE_OPTIONS=--openssl-legacy-provider nuxt build

This also works in CI and static-host build settings by prefixing the build command; Deploy a static site covers pinning the host's Node version so this stays predictable.

Copy link
Builds fail on Windows Use WSL2.

Nuxt 2 tooling and several Druxt build steps have known problems on native Windows (path separators, OpenSSL differences). Use WSL2 and run everything inside the Linux environment. That is the setup the maintainers test.

Copy link
The build fails after installing Druxt by hand Nuxt 2 needs webpack 4.

Nuxt 2 needs webpack 4. If npm installs webpack 5 in your project, add it at the version Nuxt expects:

npm install --save-dev webpack@^4.47.0
Copy link

Still stuck?