rare-sapphire
rare-sapphire13mo ago

Build Fails -node_modules/@crawlee/http/internals/http-crawler.d.ts:387:44 - error TS1005: 'assert'

I'm trying to build an actor using the below packages when I get the above error and many other related to the http-crawler.d.ts file. "@crawlee/cheerio": "^3.11.1", "apify": "^3.1.10", "crawlee": "^3.5.4" In my docker file I'm using: apify/actor-node:20 FROM apify/actor-node-playwright-chrome:18 In total there are 142 errors in the same file, starting at: node_modules/@crawlee/http/internals/http-crawler.d.ts:387 Is anyone else having a similar issue?
4 Replies
rival-black
rival-black13mo ago
Hello @MrGookis, could you please send the whole Dockerfile? Do I understand correctly that you are using a different builder and final base image? If so, using the playwright image as a builder base image could help.
rare-sapphire
rare-sapphireOP13mo ago
Yes, I am using two different builders. Below is my Dockerfile.
# using multistage build, as we need dev deps to build the TS source code
FROM apify/actor-node:20 AS builder

# copy all files, install all dependencies (including dev deps) and build the project
COPY . ./

RUN npm install --include=dev \
&& npm run build

# create final image
FROM apify/actor-node-playwright-chrome:18
# copy only necessary files
COPY --from=builder /usr/src/app/package.json ./
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json
COPY --from=builder /usr/src/app/.npmrc ./.npmrc

# install only prod deps
USER root
RUN chown -R 999:999 ".npmrc"
RUN chown -R 999:999 ".npm"

USER myuser

RUN npm --quiet set progress=false \
&& npm install --only=prod --no-optional \
&& echo "Installed NPM packages:" \
&& (npm list --only=prod --no-optional --all || true) \
&& echo "Node.js version:" \
&& node --version \
&& echo "NPM version:" \
&& npm --version

# run compiled code
CMD npm run start:prod
# using multistage build, as we need dev deps to build the TS source code
FROM apify/actor-node:20 AS builder

# copy all files, install all dependencies (including dev deps) and build the project
COPY . ./

RUN npm install --include=dev \
&& npm run build

# create final image
FROM apify/actor-node-playwright-chrome:18
# copy only necessary files
COPY --from=builder /usr/src/app/package.json ./
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json
COPY --from=builder /usr/src/app/.npmrc ./.npmrc

# install only prod deps
USER root
RUN chown -R 999:999 ".npmrc"
RUN chown -R 999:999 ".npm"

USER myuser

RUN npm --quiet set progress=false \
&& npm install --only=prod --no-optional \
&& echo "Installed NPM packages:" \
&& (npm list --only=prod --no-optional --all || true) \
&& echo "Node.js version:" \
&& node --version \
&& echo "NPM version:" \
&& npm --version

# run compiled code
CMD npm run start:prod
rival-black
rival-black13mo ago
switching the first base image to apify/actor-node-playwright-chrome:18 should help
rare-sapphire
rare-sapphireOP13mo ago
Hey @vojtechmaslan thanks for a response, however updating this did not solve the issue and the error persists. I was able to resolve my issue but using apify/actor-node-playwright-chrome:16

Did you find this page helpful?