Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Local resolution of npx with yarn #167

Open
lachrist opened this issue Dec 30, 2022 · 0 comments
Open

Local resolution of npx with yarn #167

lachrist opened this issue Dec 30, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@lachrist
Copy link
Contributor

yarn add @appland/appmap-agent-js
cd packages/sequence-diagram
npx @appland/appmap-agent-js -- npx jest
/Users/soft/Desktop/workspace/appmap-js/node_modules/npm/lib/utils/explain-dep.js:1
const chalk = require('chalk')
              ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/soft/Desktop/workspace/appmap-js/node_modules/npm/node_modules/chalk/source/index.js from /Users/soft/Desktop/workspace/appmap-js/node_modules/npm/lib/utils/explain-dep.js not supported.

I did some digging and with the agent, the command npx jest resolves to:

/Users/soft/.nvm/versions/node/v18.12.1/bin/node /Users/soft/Desktop/workspace/appmap-js/node_modules/.bin/npx jest

And sure enough this causes the same error without the involvement of the agent:

node ../../node_modules/.bin/npx jest

Whereas this works fins:

node /Users/soft/.nvm/versions/node/v18.12.1/bin/npx jest

So the problem is that the agent makes npx jest resolve to the npx installed in the project and not the globally installed npx.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant