Comments (11)
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/[email protected] puppeteer
from unlighthouse.
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:internal/modules/esm/translators:203:29)
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async Module.loader (file:///home/folder/.npm/_npx/944abecbf21dfffb/node_modules/importx/dist/chunks/tsx.mjs:22:10)
Node.js v18.20.2
from unlighthouse.
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 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.
from unlighthouse.
@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: [email protected]
(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.
from unlighthouse.
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!
from unlighthouse.
@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 [email protected]
will not work. I'm guessing you are doing npx @unlighthouse/[email protected]
?
from unlighthouse.
Using it in bash - npx [email protected]
from unlighthouse.
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
from unlighthouse.
@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: [email protected] (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,
},
};
from unlighthouse.
@harlan-zw Running npx unlighthouse-ci --config-file unlighthouse.config.ts
only works if an older version(0.12.1 or lower) is already installed.
In my case, I'm running VM scale sets in ADO. If a job is in the queue for 5 minutes, new VM is provisioned. In this scenario npx unlighthouse-ci --config-file unlighthouse.config.ts
fails with the error that others have mentioned because Unlighthouse can't be installed.
However, if I run npm install -g @unlighthouse/[email protected] puppeteer
in the first run after provisioning the agent, npx unlighthouse-ci --config-file unlighthouse.config.ts
works in subsequent runs.
from unlighthouse.
After thorough testing, I'm positive this is a dependency issue. After moving from Node v18 to Node v20, specifically v20.15.1, this issue no longer appears. I can run npx unlighthouse-ci
in all my pipelines without encountering any issues.
from unlighthouse.
Related Issues (20)
- CI scans failing since v0.11.6
- add "last updated" date / time to static report HOT 1
- Catastrophic Score HOT 7
- "Lighthouse failed to run performance audits for "/", adding back to queue." , in order to find the cause of the problem HOT 4
- Add support for LHCI basic auth HOT 1
- Mismatch between test site url and x-default causes no pages to be scanned HOT 2
- IndexedDB support HOT 1
- Running unlighthouse in Jenkins Chromium error
- CORS issue when viewing the results on Windows HOT 1
- Usage on a self-hosted server? HOT 2
- Crawling Website does not use extra headers specified in configuration HOT 6
- How to disable crawler mode using cli HOT 1
- Unlighthouse not supporting with URL contains "dot (.)"
- Bump ws to 8.17.1 HOT 2
- Can multiple reports from different websites be display? HOT 2
- How to set Rate Limit? HOT 1
- Remove FID column on Performance tab
- SyntaxError: Unexpected token 'with' HOT 2
- Puppeteer Worker only allows .html or no declared extension
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unlighthouse.