Pdfmake: bug is happening due to a jsdoc comment somewhere in the library

Created on 4 Feb 2019  路  15Comments  路  Source: bpampuch/pdfmake

I'm facing an issue when I am trying to build my Angular app.

ERROR in ./node_modules/pdfmake/build/pdfmake.js
Module build failed: Error: Debug Failure. False expression.
    at getJSDocTags (/app/node_modules/typescript/lib/typescript.js:13197:22)
    at getFirstJSDocTag (/app/node_modules/typescript/lib/typescript.js:13205:24)
    at Object.getJSDocTypeTag (/app/node_modules/typescript/lib/typescript.js:13154:19)
    at checkParenthesizedExpression (/app/node_modules/typescript/lib/typescript.js:45628:56)
    at checkExpressionWorker (/app/node_modules/typescript/lib/typescript.js:45676:28)
    at checkExpression (/app/node_modules/typescript/lib/typescript.js:45609:42)
    at checkBinaryLikeExpression (/app/node_modules/typescript/lib/typescript.js:45155:29)
    at checkBinaryExpression (/app/node_modules/typescript/lib/typescript.js:45147:20)
    at checkExpressionWorker (/app/node_modules/typescript/lib/typescript.js:45702:28)
    at checkExpression (/app/node_modules/typescript/lib/typescript.js:45609:42)
    at checkExpressionCached (/app/node_modules/typescript/lib/typescript.js:45457:38)
    at getTypeOfExpression (/app/node_modules/typescript/lib/typescript.js:45577:28)
    at checkDeclarationInitializer (/app/node_modules/typescript/lib/typescript.js:45469:24)
    at getTypeForVariableLikeDeclaration (/app/node_modules/typescript/lib/typescript.js:30738:28)
    at getWidenedTypeForVariableLikeDeclaration (/app/node_modules/typescript/lib/typescript.js:30961:24)
    at getTypeOfVariableOrParameterOrProperty (/app/node_modules/typescript/lib/typescript.js:31062:28)

It seems to be a jsdoc comment somewhere in the library.

3rd-party waiting for information

Most helpful comment

OK, Solve by updating @angular-devkit/build-angular to 0.10.3 (was 0.6.8).

Source : https://github.com/angular/angular-cli/issues/11192

All 15 comments

Yes, pdfmake of course uses jsdocs for documentation of source code. I don't understand what problem is.

We also get the same error when building our project with pdfmake v0.1.50. v0.1.41 works fine.

This is the command that we use to compile our app:
cross-env BUILD_AOT=1 SOURCE_MAP=1 node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack --config config/webpack.prod.js --progress --profile --bail

On local works fine, but the problem is when I run docker build to get ready for my deployment:

Inside docker I am using this:

Angular: 6.1.6,
node: 9.6.1,
Angular-cli: 6.1.5

In my dockerfile I have this:

FROM node:9.6.1 as node
RUN apt-get update && apt-get install -yq libgconf-2-4
RUN apt-get update && apt-get install -y wget --no-install-recommends \
    && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
    && apt-get update \
    && apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
      --no-install-recommends \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get purge --auto-remove -y curl \
    && rm -rf /src/*.deb
.
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init

WORKDIR /app
COPY package.json /app/
RUN npm install
COPY ./ /app/
# Run lint
RUN npm run lint
# Run unit tests to ensure that the image being built is valid
RUN npm run test -- --browsers ChromeHeadlessNoSandbox --watch=false
# Run end to end tests to ensure that the image being built is valid
# RUN npm run e2e
# Build the angular application with production configuration by default
ARG conf=production
RUN npm run build -- --output-path=./dist/one --configuration $conf

# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:alpine
COPY --from=node /app/dist/one/ /usr/share/nginx/html
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf

it fails in the step:

RUN npm run build -- --output-path=./dist/one --configuration $conf

outside docker works fine for me.

pdfmake version 0.1.50 contains updated pdfkit library to version 0.9.0 (ported from coffescript to ES6).

We need to find where exactly is problem with jsdoc comment.

Hi, I'm facing the same issue.

Configuration:

Angular CLI: 7.3.0
Node: 10.3.0
OS: win32 x64
Angular: 6.0.9

This happens only when I run
ng build --configuration=test
when I run it in ng serve it's working good.

Appreciate your help.

BTW, thanks for this library ;)

I'm using Angular 6.1.10, and have the same issue when I run the following command

ng build --prod

Can anyone turn on some "debug mode" to find out which line is causing a problem with jsdoc?

Same issue on :

  • Angular CLI: 7.2.4
  • Node: 10.15.1
  • NPM: 6.4.1
  • OS: darwin x64 (MacOS High Sierra 10.13.6)
  • Angular: 7.2.3

But no problem on :

  • Angular CLI: 7.2.4
  • Node: 11.9.0
  • NPM: 6.5
  • OS: linux x64 (Ubuntu 18.10)
  • Angular: 7.2.3

OK, Solve by updating @angular-devkit/build-angular to 0.10.3 (was 0.6.8).

Source : https://github.com/angular/angular-cli/issues/11192

In environment where it does not work, please try these variously modified pdfmake:
https://github.com/bpampuch/pdfmake/issues/1655#issuecomment-468905541

I ran eslint with https://github.com/gajus/eslint-plugin-jsdoc locally and got following:

284 problems (0 errors, 284 warnings)
0 errors and 77 warnings potentially fixable with the --fix option.

@liborm85 are you interested in adding to pdfmake by default?

You may want to configure a npm script to run eslint. It will allow to run --fix command (with gulp-eslint is possible but more complex). It will allow to drop gulp-eslint dependency altogether

OK, Solve by updating @angular-devkit/build-angular to 0.10.3 (was 0.6.8).

Source : angular/angular-cli#11192

I found just updating the package.json file caused this error.
Could not find module "@angular-devkit/build-angular" from "C:\\Program Files (x86)\\MyApps\\CoolApp\\App"
Running this command fixed that error and then ng build --prod worked.
npm install --save-dev @angular-devkit/build-angular

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sayjeyhi picture sayjeyhi  路  3Comments

kumarandena picture kumarandena  路  3Comments

einfallstoll picture einfallstoll  路  3Comments

m-brudi picture m-brudi  路  3Comments

CharlyPoppins picture CharlyPoppins  路  3Comments