Open ivanmihaljevicdiageo opened 1 month ago
getting an error since upgrading to 12.2 this morning that I think is related here. My unlighthouse.config file was working great before upgrading:
(node:691801) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ...
to show where the warning was created)
/home/folder/unlighthouse.config.ts:1
export default {
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:76:18)
at wrapSafe (node:internal/modules/cjs/loader:1283:20)
at Module._compile (node:internal/modules/cjs/loader:1328:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at ModuleWrap.
Node.js v18.20.2
Also getting the same error as @y2gabs Running latest
with npm add -g @unlighthouse/cli puppeteer
then unlighthouse-ci --config-file unlighthouse.config.ts
on GitHub Actions ubuntu-22.04 default image.
Will revert to the previous version with npm add -g @unlighthouse/cli@0.12.1 puppeteer
Thank you for the reports, I'm trying to replicate but having issues. I'm not exactly sure what's going on, maybe related to an upstream dependency or https://github.com/harlan-zw/unlighthouse/commit/0c6a0eb.
Could you try npx unlighthouse-ci --config-file unlighthouse.config.ts
? This should be all that's needed within a CI now but I need to test further.
@harlan-zw it's the same issue using npx directly:
Run npx unlighthouse-ci --config-file unlighthouse.config.ts
npm WARN exec The following package was not found and will be installed: unlighthouse-ci@0.12.2
(node:1525) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Error: Unexpected token 'export'
export default {
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:76:18)
at wrapSafe (node:internal/modules/cjs/loader:1283:20)
at Module._compile (node:internal/modules/cjs/loader:1328:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1[4](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:5)22:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
at ModuleJob.run (node:internal/modules/esm/module_job:19[5](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:6):25)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async Module.loader (/home/runner/.npm/_npx/b17dc438925[6](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:7)a785/node_modules/importx/dist/chunks/tsx.mjs:22:10)
Error: Process completed with exit code 1.
Forgot to mention that I'm using npx directly too. I just specify 0.12.1 in my scan and it works for now. This is such a great tool so thank you for all you do!
@y2gabs how are you doing that? (what command)? As unlighthouse-ci
has only existed since v0.12.2 https://www.npmjs.com/package/unlighthouse-ci?activeTab=versions. npx unlighthouse-ci@0.12.1
will not work. I'm guessing you are doing npx @unlighthouse/cli@0.12.1
?
Using it in bash - npx unlighthouse@0.12.1
weird hit & miss issues running 0.12.1 this week unfortunately. Scan only seems to run half the time, the other half it seems to hang during the scan. Weird
@harlan-zw it's the same issue using npx directly:
Run npx unlighthouse-ci --config-file unlighthouse.config.ts npm WARN exec The following package was not found and will be installed: unlighthouse-ci@0.12.2 (node:1525) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use `node --trace-warnings ...` to show where the warning was created) Error: Unexpected token 'export' export default { ^^^^^^ SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:76:18) at wrapSafe (node:internal/modules/cjs/loader:1283:20) at Module._compile (node:internal/modules/cjs/loader:1328:27) at Module._extensions..js (node:internal/modules/cjs/loader:1[4](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:5)22:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29) at ModuleJob.run (node:internal/modules/esm/module_job:19[5](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:6):25) at async ModuleLoader.import (node:internal/modules/esm/loader:337:24) at async Module.loader (/home/runner/.npm/_npx/b17dc438925[6](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:7)a785/node_modules/importx/dist/chunks/tsx.mjs:22:10) Error: Process completed with exit code 1.
I'm able to reproduce the Unexpected token 'export'
issue as well with v0.13.1
(the latest as of this comment is made), but not with npx unlighthouse-ci
. It seems starting to appear from v0.12.2
.
Failed GitHub Action FYR: https://github.com/mwskwong/mwskwong.com/actions/runs/9573986998/job/26396439815
Workflow
name: Unlighthouse
on: deployment_status
jobs:
unlighthouse:
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install -g @unlighthouse/cli puppeteer
- run: npm list -g @unlighthouse/cli
- run: unlighthouse-ci --site ${{ github.event.deployment_status.environment_url }}
- uses: actions/upload-artifact@v4
if: always()
with:
path: ./.unlighthouse
unlighthouse.config.ts
export default {
cache: false,
ci: {
buildStatic: true,
budget: {
performance: 95,
accessibility: 92,
'best-practices': 100,
seo: 66,
},
},
scanner: {
samples: 5,
},
};
Describe the bug
In ADO pipeline, I run
npm install -g @unlighthouse/cli puppeteer
andunlighthouse-ci --site $(deploymentUrl) --config-file unlighthouse-desktop.config.ts --debug --output-path $(System.DefaultWorkingDirectory)/$(VERCEL_PROJECT_NAME)-lighthouse
. Since 0.12.2 release, I get this error:Reverting to v0.12.1 solves the issue
Reproduction
No response
System / Nuxt Info
No response