Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running fails with "cannot find module" #2622

Open
nzakas opened this issue Jan 24, 2024 · 0 comments
Open

Running fails with "cannot find module" #2622

nzakas opened this issue Jan 24, 2024 · 0 comments

Comments

@nzakas
Copy link

nzakas commented Jan 24, 2024

I'm trying to run web-test-runner inside of a monorepo and I get this error:

$ npm test -w packages/memory

> fsx-memory@0.4.0 test
> web-test-runner --node-resolve tests/*.js

node:internal/modules/cjs/loader:452
      throw err;
      ^

Error: Cannot find module 'C:\Users\nzaka\projects\humanwhocodes\fsx\packages\web\node_modules\proxy-agent\dist\index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:444:19)
    at Module._findPath (node:internal/modules/cjs/loader:715:18)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (C:\Users\nzaka\projects\humanwhocodes\fsx\packages\web\node_modules\@puppeteer\browsers\lib\cjs\httpUtil.js:46:23)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32) {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Users\\nzaka\\projects\\humanwhocodes\\fsx\\packages\\web\\node_modules\\proxy-agent\\package.json',
  requestPath: 'proxy-agent'
}

Node.js v20.11.0
npm ERR! Lifecycle script `test` failed with error: 
npm ERR! Error: command failed
npm ERR!   in workspace: fsx-web@0.4.0
npm ERR!   at location: C:\Users\nzaka\projects\humanwhocodes\fsx\packages\web 

Some other details about the project:

  • Using ESM via package.json "type": "module"
  • Monorepo using npm workspaces
Environment Info

@web/test-runner v0.18.0

$ npx envinfo

  System:
    OS: Windows 10 10.0.19045
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 7.10.0 - C:\Program Files\nodejs\npm.CMD   

Reproduction steps

  1. Clone https://github.com/humanwhocodes/fsx
  2. npm install
  3. cd packages/memory
  4. npm i @web/test-runner
  5. Update "test" script in package.json to be "web-test-runner tests/*.js --node-resolve"
  6. Run npm test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant