Skip to content

Cannot run np globally on Node.js v20.12.2 #747

@mesqueeb

Description

@mesqueeb

executing my global np while being in a directory that also has np installed locally.

/usr/local/lib/node_modules/np/node_modules/import-local/index.js:23
	return !filenameInLocalNodeModules && localFile && path.relative(localFile, normalizedFilename) !== '' && require(localFile);
                                                                                                           ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/empidornis/ghq/github.com/mesqueeb/FuegoOnAppleSilicon/node_modules/np/source/cli.js from /usr/local/lib/node_modules/np/node_modules/import-local/index.js not supported.
Instead change the require of cli.js in /usr/local/lib/node_modules/np/node_modules/import-local/index.js to a dynamic import() which is available in all CommonJS modules.
    at module.exports (/usr/local/lib/node_modules/np/node_modules/import-local/index.js:23:108)
    at file:///usr/local/lib/node_modules/np/source/cli.js:9:6 {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions