Hi,
Im trying use puppeteer in an angular app and get this error when compiling.
ERROR in node_modules/@types/puppeteer/index.d.ts(15,38): error TS1005: ';' expected.
node_modules/@types/puppeteer/index.d.ts(15,73): error TS1005: '(' expected.
node_modules/@types/puppeteer/index.d.ts(15,76): error TS1005: ')' expected.
node_modules/@types/puppeteer/index.d.ts(18,40): error TS1005: ';' expected.
node_modules/@types/puppeteer/index.d.ts(18,68): error TS1005: ';' expected.
node_modules/@types/puppeteer/index.d.ts(18,71): error TS1109: Expression expected.
and sometimes https://hastebin.com/upereteman.coffeescript .
@marvinhagemeister @cdeutsch @ksm2
@iserifith Are you sure that your node_modules directory is up to date? The linked output looks like some dependencies are missing.
It was fresh angular instalation. I even tried remove the node modules folder and install it again. Here is my package.json
@iserifith The definitions are correct. Everything I can find on google with that error message points to using an outdated tsc instance. https://stackoverflow.com/questions/46398916/typescript-error-ts1005-expected?rq=1
I switch the typescript version to 2.8.1. however this still persist. Could it be a path issue? I manually check the node_module folders and everything is there.
@iserifith You are using puppeteer which is made for Node.js in a browser environment. Therefore, modules like fs, crypto and child_process are missing. This has nothing to do with these typings.
That makes sense. Thank you.
This still applies to node environments. Simple reproduction steps:
git clone --depth=1 https://github.com/Microsoft/TypeScript-Node-Starter.git <project_name>cd <project_name> && npm i -S puppeteer && npm i -S -D @types/puppeteerserver.ts and import puppeteer: import puppeteer from 'puppeteer';npm run buildI have tried lots of combinations of ignoring node_modules to no avail. @ksm2 or anyone else: please advise how to solve this. @marvinhagemeister my TypeScript version is "typescript": "^2.7.2"
@jsdevtom You need at least TypeScript 2.8 (see here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/puppeteer/index.d.ts#L7)
I tried your reproduction steps, using TypeScript 2.8 works:
npm i [email protected]npm run build@ksm2 Thank you! That worked!
Most helpful comment
@jsdevtom You need at least TypeScript 2.8 (see here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/puppeteer/index.d.ts#L7)
I tried your reproduction steps, using TypeScript 2.8 works:
npm i [email protected]npm run build