Pptxgenjs: Webpack finding missing dependencies

Created on 30 Jul 2018  路  6Comments  路  Source: gitbrent/PptxGenJS

I'm using this package in combination with webpack to run with React in the browser, but when using the version in master (2.3.0-beta), It finds that there's specific parts of specific dependencies missing. Below is the error dump. Any thoughts? Before anyone asks, I'm trying to use 2.3.0-beta because due to the nature of my project, i can't run code with the vulnerabilities in Jquery-node that 2.2.0 has.

WARNING in ./node_modules/jsdom/lib/jsdom/utils.js 186:21-40
Critical dependency: the request of a dependency is an expression
@ ./node_modules/jsdom/lib/jsdom/browser/Window.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

WARNING in ./node_modules/parse5/lib/index.js 55:23-49
Critical dependency: the request of a dependency is an expression
@ ./node_modules/jsdom/lib/jsdom/browser/domtohtml.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

ERROR in ./node_modules/jsdom/lib/jsdom/living/xmlhttprequest.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\lruberl\Documents\backend\node_modules\jsdom\lib\jsdom\living'
@ ./node_modules/jsdom/lib/jsdom/living/xmlhttprequest.js 4:22-46
@ ./node_modules/jsdom/lib/jsdom/browser/Window.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\lruberl\Documents\backend\node_modules\forever-agent'
@ ./node_modules/forever-agent/index.js 6:10-24
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/browser/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

ERROR in ./node_modules/request/node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\lruberl\Documents\backend\node_modules\request\node_modules\tough-cookie\lib'
@ ./node_modules/request/node_modules/tough-cookie/lib/cookie.js 32:10-24
@ ./node_modules/request/lib/cookies.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/browser/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

ERROR in ./node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\lruberl\Documents\backend\node_modules\tough-cookie\lib'
@ ./node_modules/tough-cookie/lib/cookie.js 32:10-24
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\lruberl\Documents\backend\node_modules\tunnel-agent'
@ ./node_modules/tunnel-agent/index.js 3:10-24
@ ./node_modules/request/lib/tunnel.js
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/browser/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'C:\Users\lruberl\Documents\backend\node_modules\forever-agent'
@ ./node_modules/forever-agent/index.js 7:10-24
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/browser/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'C:\Users\lruberl\Documents\backend\node_modules\tunnel-agent'
@ ./node_modules/tunnel-agent/index.js 4:10-24
@ ./node_modules/request/lib/tunnel.js
@ ./node_modules/request/request.js
@ ./node_modules/request/index.js
@ ./node_modules/jsdom/lib/jsdom/browser/resource-loader.js
@ ./node_modules/jsdom/lib/api.js
@ ./node_modules/pptxgenjs/dist/pptxgen.js
@ ./frontend/src/components/Generate.js
@ ./frontend/src/components/App.js
@ ./frontend/src/index.js

Most helpful comment

@yodasodabob Ah, okay.

Does adding "jsdom": false under "browser" in package.json fix the issue?

screen shot 2018-10-03 at 19 06 25

All 6 comments

After some additional fiddling, it seems to be coming specifically from jsdom.

I am having exactly the same issue. Even when forcing pptxgenjs to version 2.0.0 on a clean yarn install (no node_modules present in my project), I get the above mentioned problem when compiling my project via webpack. The only way around this for me is to 'yarn remove pptxgenjs' and then 'yarn add [email protected]' again.

@yodasodabob Ah, okay.

Does adding "jsdom": false under "browser" in package.json fix the issue?

screen shot 2018-10-03 at 19 06 25

Hopefully fixed in upcoming 2.4.0 with Issue #415 and package.json updates.

hope it should help someone as I've just faced the same problem and could manage by doing the following in scripts session:

Angular :: package.json

Was: "build:prod": "./node_modules/.bin/ng build --prod --aot=false --base-href ."

Now: "build:prod": "./node_modules/.bin/ng build --env=prod --aot=false --base-href ."

The only thing I've changed was --prod to --env=prod and error was gone.

I added browser in my package.json at the end of file as mentioned by gitbrent. It compiled successfully but when page load I get the below error,
i ndex.js:7 Uncaught ReferenceError: __dirname is not defined at Object../node_modules/yuicompressor/nodejs/index.js (index.js:7) at __webpack_require__ (bootstrap:76) at Object../src/app/home/home.component.ts (main.js:207) at __webpack_require__ (bootstrap:76) at Object../src/app/app.module.ts (app.component.ts:8) at __webpack_require__ (bootstrap:76) at Object../src/main.ts (environment.ts:15) at __webpack_require__ (bootstrap:76) at Object.0 (main.ts:12) at __webpack_require__ (bootstrap:76)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DSheffield picture DSheffield  路  3Comments

pimlottc-gov picture pimlottc-gov  路  3Comments

colmben picture colmben  路  6Comments

simonjcarr picture simonjcarr  路  6Comments

kevinresol picture kevinresol  路  3Comments