Help us shape the future of Go! Take the 2026 Go Developer Survey

nodeengine

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package nodeengine refuses to run npm in a frontend on a Node the frontend's package.json says it does not support.

npm treats `engines.node` as advice: it prints EBADENGINE and installs anyway. On a Node below the scaffold's floor that install does not fail cleanly. npm 10.8 on Node 20 crashes resolving the scaffolded frontend's tree (vite 8, vitest 5):

npm error Cannot read properties of null (reading 'edgesOut')

which names neither Node nor the floor, and sends the reader to npm bug trackers. Checking the declared range first turns that into one line that names the two versions and the fix.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(dir string) error

Check returns an error when the node on PATH does not satisfy the `engines.node` range that dir/package.json declares.

It returns nil whenever it cannot judge: no node on PATH (npm's own error is clearer then), no package.json, no `engines.node`, or a range in a form Check does not read. Refusing on a range it misread would block a working install, which is worse than the crash it exists to explain.

func Satisfies

func Satisfies(version, rng string) (ok, judged bool)

Satisfies reports whether version ("v22.12.0" or "22.12.0") satisfies the npm range rng, and whether it could judge at all. It reads the forms forge scaffolds and the toolchains it pins declare: alternatives joined by "||", each ">=X[.Y[.Z]]", "^X[.Y[.Z]]" or a bare "X[.Y[.Z]]" (the same major and at least that version). Any other form makes the whole range unjudged.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL