abhinaba-ghosh / playwright-lighthouse

:performing_arts:: Playwright Lighthouse Audit
https://www.npmjs.com/package/playwright-lighthouse
MIT License
250 stars 28 forks source link

Lighthouse library should be a dependency instead of a devDependency #63

Closed ankur-lt closed 11 months ago

ankur-lt commented 11 months ago

I am getting the following error when executing the playAudit() function after installing playwright-lighthouse library. The error is as follows:

node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'lighthouse' imported from /Users/ankur/playwright_test_suite/node_modules/playwright-lighthouse/src/task.js
    at new NodeError (node:internal/errors:399:5)
    at packageResolve (node:internal/modules/esm/resolve:889:9)
    at moduleResolve (node:internal/modules/esm/resolve:938:20)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Cause for this: The lighthouse library has been added in playwright-lighthouse as a devDependency. In a node project, the dev-dependencies of a dependency aren't installed. This, this error is shows everytime and users need to explicitly install lighthouse in the project.