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

test script crashes with bad invocation of npx #1921

Closed
rotu opened this issue Apr 21, 2023 · 4 comments
Closed

test script crashes with bad invocation of npx #1921

rotu opened this issue Apr 21, 2023 · 4 comments

Comments

@rotu
Copy link

rotu commented Apr 21, 2023

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

20.0.0

What operating system are you using?

macOS

What CPU architecture are you using?

Apple M1

What Node versions, OSs and CPU architectures are you building for?

default

Describe the Bug

npm run test fails, as the code in pkg/test/test-10-pnpm/main.js attempts to
call npm from the wrong fully qualified path. The code falsely assumes that the node and the npx executables exist as sibling files in the same directory.

Note that, as installed by homebrew, the following executable and symlinks exist:

  • /opt/homebrew/Cellar/node/20.0.0/bin/node
  • /opt/homebrew/Cellar/node/20.0.0/libexec/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js
  • /opt/homebrew/Cellar/node/20.0.0/libexec/bin/npx -> ../lib/node_modules/npm/bin/npx-cli.js
  • /opt/homebrew/bin/npm -> /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js
  • /opt/homebrew/bin/npx -> /opt/homebrew/lib/node_modules/npm/bin/npx-cli.js
  • /opt/homebrew/bin/node -> ../Cellar/node/20.0.0/bin/node
npm run test

> pkg@5.8.1 test
> npm run build && npm run test:18 && npm run test:16 && npm run test:14 && npm run test:host


> pkg@5.8.1 build
> npm run clean && tsc


> pkg@5.8.1 clean
> rimraf lib-es5


> pkg@5.8.1 test:18
> node test/test.js node18 no-npm

Debugger listening on ws://127.0.0.1:59850/a219d318-6cf6-426f-98fa-049fe3357707
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

*************************************
node18 no-npm
*************************************

Debugger listening on ws://127.0.0.1:59852/f2f10443-fe9d-43b9-8dd5-e8906e72e2e4
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
target =  node18
> /opt/homebrew/Cellar/node/20.0.0/bin/npx pnpm install
Waiting for the debugger to disconnect...
/Users/dan/Source/pkg/test/utils.js:89
    throw child.error;
    ^

Error: spawnSync /opt/homebrew/Cellar/node/20.0.0/bin/npx ENOENT
    at Object.spawnSync (node:internal/child_process:1117:20)
    at spawnSync (node:child_process:871:24)
    at module.exports.spawn.sync (/Users/dan/Source/pkg/test/utils.js:74:17)
    at Object.<anonymous> (/Users/dan/Source/pkg/test/test-10-pnpm/main.js:27:29)
    at Module._compile (node:internal/modules/cjs/loader:1267:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
    at Module.load (node:internal/modules/cjs/loader:1125:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync /opt/homebrew/Cellar/node/20.0.0/bin/npx',
  path: '/opt/homebrew/Cellar/node/20.0.0/bin/npx',
  spawnargs: [ 'pnpm', 'install' ]
}

Expected Behavior

npm run test should succeed.

To Reproduce

npm run test

@rotu rotu changed the title test script invokes npx from missing path test script crashes with bad invocation of npx Apr 23, 2023
@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

@github-actions github-actions bot added the Stale label Jul 23, 2023
@rotu
Copy link
Author

rotu commented Jul 23, 2023

.

@github-actions github-actions bot removed the Stale label Jul 24, 2023
@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

@github-actions github-actions bot added the Stale label Oct 23, 2023
@rotu
Copy link
Author

rotu commented Oct 23, 2023

.

@github-actions github-actions bot removed the Stale label Oct 24, 2023
@leerob leerob closed this as completed Jan 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants