denoland/deno · error · AnyError

The hoisted node_modules linker requires --node-modules-dir=

Error message

The hoisted node_modules linker requires --node-modules-dir=manual. Add "nodeModulesDir": "manual" to your deno.json or pass --node-modules-dir=manual on the command line.

What it means

Error "The hoisted node_modules linker requires --node-modules-dir=manual. Add "nodeModulesDir": "manual" to your deno.json or pass --node-modules-dir=manual on the command line." thrown in denoland/deno.

Source

Thrown at libs/resolver/factory.rs:430

      .node_modules_linker_mode
      .get_or_try_init(|| {
        if let Some(process_state) = &self.options.npm_process_state
          && let Some(mode) = process_state.linker_mode
        {
          return Ok(mode);
        }
        let mode = if let Some(flag) = self.options.node_modules_linker {
          flag
        } else {
          let workspace = &self.workspace_directory()?.workspace;
          workspace
            .node_modules_linker()?
            .unwrap_or_default()
        };
        if mode == NodeModulesLinkerMode::Hoisted {
          let dir_mode = self.raw_node_modules_dir_mode()?;
          if dir_mode != NodeModulesDirMode::Manual {
            bail!(
              "The hoisted node_modules linker requires --node-modules-dir=manual. \
               Add \"nodeModulesDir\": \"manual\" to your deno.json or pass \
               --node-modules-dir=manual on the command line."
            );
          }
        }
        Ok(mode)
      })
      .copied()
  }

  /// Resolves the path to use for a local node_modules folder.
  pub fn node_modules_dir_path(&self) -> Result<Option<&Path>, anyhow::Error> {
    fn resolve_from_root(root_folder: &FolderConfigs, cwd: &Path) -> PathBuf {
      root_folder
        .deno_json
        .as_ref()
        .map(|c| Cow::Owned(c.dir_path()))

View on GitHub (pinned to 9ad36f7a2c)

When it happens

Trigger: Thrown at libs/resolver/factory.rs:430 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/b94cdc8009b01347. Report an issue: GitHub.