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.
I did some digging and with the agent, the command
npx jest
resolves to:And sure enough this causes the same error without the involvement of the agent:
Whereas this works fins:
So the problem is that the agent makes
npx jest
resolve to thenpx
installed in the project and not the globally installednpx
.