Playwright - state.conditions.includes is not a function

I've done a new load to create a new actor using npx crawlee create app, then selecting the Playwright Typescript template. Once all npm packages have been loaded I then cd into app and tried npm start. I get the below error, I then tryied to download the crawlee playwright packages npm install crawlee playwright however I still have this issue trying to run the actor. I have not modified the template that is provided when using npx crawlee create. Any help or guidance is appreciated. node_modules\typescript\lib\typescript.js:41322 if (condition === "default" state.conditions.includes(condition) isApplicableVersionedTypesKey(state.conditions, condition)) { ^ TypeError: state.conditions.includes is not a function
16 Replies
Pepa J
Pepa J•2y ago
Hi @MrGookis Thank you for reaching us. I am able to reproduce the issue and I will raise it internally, so it hopefully will be solved soon. There currently seems to be something wrong with typescript v3 as a workaround you may set the typescript dependency in package.json to:
"typescript": "~5.2.2"
"typescript": "~5.2.2"
And run npm install after. Then I was able to run the template as usual. We are currently working on fixing the version in our dependecies in templates.
stormy-gold
stormy-goldOP•2y ago
@Pepa J Thanks for the update, I have gone ahead an specified version 5.2.2.
like-gold
like-gold•2y ago
I have the same, and changed "typescript" but am not able to push it to Apify, it throws an error that i did not have before: Property '[Symbol.asyncDispose]' is missing in type 'PlaywrightBrowser' but required in type 'Browser'. 2023-11-23T17:26:34.969Z 12 export declare class PlaywrightBrowser extends EventEmitter implements Browser { 2023-11-23T17:26:34.971Z ~~~ 2023-11-23T17:26:34.974Z node_modules/playwright-core/types/types.d.ts:16581:3 2023-11-23T17:26:34.976Z 16581 Symbol.asyncDispose: Promise<void>; 2023-11-23T17:26:34.978Z ~~~~~~~~~ 2023-11-23T17:26:34.980Z '[Symbol.asyncDispose]' is declared here. 2023-11-23T17:26:34.982Z Found 1 error in node_modules/@crawlee/browser-pool/playwright/playwright-browser.d.ts:12
MEE6
MEE6•2y ago
@JanBarendse just advanced to level 4! Thanks for your contributions! 🎉
Pepa J
Pepa J•2y ago
@JanBarendse Hmm, I cannot reproduce that, may you create a new project from template and compare the package.json and Dockerfile with your project? my apify push succeeded with no further issues.
like-gold
like-gold•2y ago
new project gives the same error, is it to do with the updated Crawlee ? pushing to apify, this is the significant error: 2023-11-23T18:02:41.641Z '[Symbol.asyncDispose]' is declared here. 2023-11-23T18:02:41.642Z Found 1 error in node_modules/@crawlee/browser-pool/playwright/playwright-browser.d.ts:12 There is something out of sync, creating a boilerplate [playwright TS] app gives the [Symbol.asyncDispose] error. Then changing to Typescript 5.2 in packages solves it locally, but then pushing it to Apify it renders the same error.
Pepa J
Pepa J•2y ago
@JanBarendse What do you get for apify -v command?
like-gold
like-gold•2y ago
apify-cli/0.19.1 win32-x64 node-v18.17.1
Pepa J
Pepa J•2y ago
@JanBarendse I got the same, what about npm -v typescript? Just to be sure..
like-gold
like-gold•2y ago
10.2.4
No description
Pepa J
Pepa J•2y ago
@JanBarendse Is there the Build in the Apify Console, can you link it to me in personal message?
like-gold
like-gold•2y ago
Hi Pepa, there you go Thanks in advance Pepa, while waiting any tricks to get it to build, its only 2 files. Insert it into a duplicated online actor ? i made a copy of an other online actor, changed the code, that worked. for now.
Pepa J
Pepa J•2y ago
@JanBarendse I see, you are probably creating actor through crawlee create instead of apify create - which is what I tested (and recommend you to use it when Actors should run on Apify Platform). I was able to reproduce it now. I will report this bug it internally.
like-gold
like-gold•2y ago
THANKS!, but sorry, cannot keep the crawlee and apify apart with regards to functionality.
Pepa J
Pepa J•2y ago
There is a new release of crawlee today 3.6.2 that should fix this issue. Try npm i [email protected] and let me know if it helps - it worked for me 🙂
like-gold
like-gold•2y ago
wooop, just went the apify way, wiil try later.

Did you find this page helpful?