Apify

Apify and Crawlee Official Forum

b
F
A
J
A

How to upgrade Crawlee+Playwright to the latest versions?

6 month ago I created a Crawlee+Playwright+"node-beanstalk"(a JS wrapper for Beanstalkd message queue) project. I was following Crawlee documentation, created some... template? and started to add things to this template (no Docker image was used. I just installed things on Ubuntu machine).
And somehow it works (and it still wonders me)))

This is the versions used at the moment (my package.json is below, feel free to take look/criticize, i know it is not perfect):
Plain Text
   crawlee/core 3.3.1
   playwright 1.33.0

   npm:  8.19.3
   node: 16.19.0


Now I see that the latest Crawlee version is 3.5, latest Playwright is 1.39 and may be some other packages are updated. It is time to update.

So, what is the proper way to update Crawlee and Playwright in such project?
Is it just this:
Plain Text
   npm update playwright
   npm update crawlee

Or something else?

I use headless Firefox it is installed here:
~/.cache/ms-playwright/firefox-1403/
How to update it?

Disclaimer: i am not a JS developer, i am Java developer who somehow writes JS code (lot of copy/paste, yes) so I know that dependency management is not that easy, so I think it is better to ask in this forum than create a mess is my project...
n
h
L
4 comments
my package.json:

Plain Text
{
    "name": "cr-q-onestep",
    "version": "0.0.1",
    "type": "module",
    "description": "This is an example of a Crawlee project.",
    "dependencies": {
        "crawlee": "^3.0.0",
        "node-beanstalk": "^1.6.8",
        "playwright": "*",
        "ts-promise": "^2.2.0"
    },
    "devDependencies": {
        "@apify/tsconfig": "^0.1.0",
        "ts-node": "^10.8.0",
        "typescript": "^4.7.4"
    },
    "scripts": {
        "start": "npm run start:dev",
        "start:prod": "node dist/main.js",
        "start:dev": "ts-node-esm -T src/main.ts test smartProxyRotatingUS 200 370 2 2",
        "build": "tsc",
        "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
    },
    "author": "It's not you it's me",
    "license": "ISC"
}
simply type

npm i crawlee

npm i playwright

this will install latest version, you can check it here

https://www.npmjs.com/package/crawlee
https://www.npmjs.com/package/playwright
In JS, you usually have also package-lock.json which keeps your versions and only upgrades if you force it in package.json. You can do that by setting the minimal version like this:

Plain Text
"crawlee": "^3.5.8",
I think these are correct steps:

edit package.json
npm i crawlee
npm i playwright
npx playwright install
npm run build

Without npx playwright install it writes into log:

Looks like Playwright Test or Playwright was just installed or updated.
Please run the following command to download new browsers:
npx playwright install
Add a reply
Sign up and join the conversation on Discord
Join