pptxgenjs 3.0 node js ReferenceError: JSZip is not defined - node.js

On Friday January 3rd, 2019, pptxgenjs library has been upgraded from version 2.6.0 to 3.0.0. This being said when I upgraded the package and attempted to start my server it gave me the following error
ReferenceError: JSZip is not defined
at Object.<anonymous> (/Users/a.farghaly/Desktop/up-api/node_modules/pptxgenjs/dist/pptxgen.min.js:2:190018)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Module.require (internal/modules/cjs/loader.js:830:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.<anonymous> (/Users/a.farghaly/Desktop/upsiide-api/utility/powerpoint/ppt.js:1:19)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
[nodemon] app crashed - waiting for file changes before starting...
This being said JSZip works fine with the previouse version (2.6.0)
I would be thankful if anyone can help me with this issue
A screenshot from npmjs.com main page trying pptxgenjs v3.0.0

It's a bug: https://github.com/gitbrent/PptxGenJS/issues/638
Using https://github.com/gitbrent/PptxGenJS.git#2cee3f0c412106aefb1f87fc16bfef78ae5521a7 and it works with NodeJS.

It’s a bug where Node was referencing dist/pptxgenjs.min.js intead of dist/pptxgenjs.min.js. In pptxgenjs.min.js jszip library is not defined

Related

Cannot import cloudinary in nodeJS with "navigator undefined" error

I recently installed cloudinary via npm and cannot import it in my nodeJS backend due to the following error.
(base) feiwu#Feis-MacBook-Pro backend % node server.js
/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:1168
var useAgent = navigator && navigator.userAgent || '';
^
ReferenceError: navigator is not defined
at Module../src/namespace/cloudinary-core.js (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:1168:16)
at __webpack_require__ (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:37:30)
at /Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:101:18
at /Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:104:10
at webpackUniversalModuleDefinition (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:10:20)
at Object.<anonymous> (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:17:3)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary/lib/utils/index.js:48:57)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
I have found nothing so far about this error and would like to know if someone know about this issue ?
This error is from cloudinary's end. Fix this error with npm i cloudinary-core.
Started happening to me around 15 hours ago as well.
Cloudinary had just released a new version to its JS SDK (version 2.12.2) that fixes this issue.
installing cloudinary-core helped me get rid of this error
npm i cloudinary-core
This issue was introduced recently in Cloudinary version 1.28.0.
https://www.npmjs.com/package/cloudinary/v/1.28.0
The issue reported on github here : https://github.com/cloudinary/cloudinary_npm/issues/524
I was able to fix this issue by pointing cloudinary to 1.27.1
"cloudinary": "1.27.1"
Cloudinary guys have fixed this issue here : https://github.com/cloudinary/cloudinary_js/pull/281.

internal modules cjs is not working after yarn upgraded to 1.13.0

I have a react app which is based on react boilerplate. I am running the
following command:
cross-env NODE_ENV=development node --experimental-modules ./server/index.mjs
After upgrading yarn to 1.13.0, I am getting the following error:
(node:11137) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/cjs/loader.js:677
module.reflect.onReady((reflect) => {
^
TypeError: Cannot read property 'onReady' of undefined
at Module.load (internal/modules/cjs/loader.js:677:22)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Module.require (internal/modules/cjs/loader.js:705:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/Users/mdjahidulislam/workspace/ifs/frontend/node_modules/psl/index.js:14:19)
at Module._compile (internal/modules/cjs/loader.js:799:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Seems like module.reflect is undefined. In which scenario it can be undefined and how I can solve the problem.
Thanks in advance for any help and suggestions.
Finally solved it. It was all about nodejs version. I had nodejs version 11.* and then I downgraded it on 10.* and it solved the issue.

ExpressJS and RethinkDb Tutorial Cannot read property 'prototype' of undefined

Very new to Db and JS and trying to learn ExpressJS, RethinkDb using a tutorial from this link.
https://github.com/rethinkdb/rethinkdb-example-nodejs-chat
I followed the instructions and hitting an error in basic module loading I suppose. Looks like some dependency problem or I'm probably missing some step.
As specified in the instruction, I have successfully setup rethinkDb and can see the DB explorer in
http://localhost:8080
But when node app is executed as specified in instructions, I"m hitting an error below. Any help in this regard please?
/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/store.js:35
Store.prototype.__proto__ = EventEmitter.prototype;
^
TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/store.js:35:42)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/manager.js:16:13)
at Module._compile (module.js:643:30)
process.EventEmitter was deprecated and not working in new node version. This has been answered here
Can you rollback to older node.js version and see if you could run the tutorial
https://github.com/LearnBoost/websocket.io/issues/55

upgraded node to v0.8 and started receiving an error for sys/util

I upgraded from node v0.6.12 to 0.80 and started receiving the error below - I have removed the sys module from the import but am still getting the error. Any helpful hints would be helpful. I am not suing stylus either.
path.exists is now called `fs.exists`.
sys.js:1
throw new Error(
Error: The "sys" module is now called "util".
at sys.js:1:69
at NativeModule.compile (node.js:602:5)
at Function.NativeModule.require (node.js:570:18)
at Function.Module._load (module.js:297:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/node/node_modules/stylus/lib/token.js:12:15)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
Upgrade to node v0.8.1. It will solve your problem

Node + Coffeescript + Zappa

I have been looking around for the best framework with nodejs. I am starting to lean twords Zappa. I was testing it out and everything was working fine until I started a new project and reinstalled it with npm.
Now any time I do anything with it, it throws this error.
This
require('zappa') ->
console.log "Hello World!"
Becomes
TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (/home/giodamelio/Projects/node-boilerplate/node_modules/zappa/lib/zappa.js:65:15)
at Object.<anonymous> (/home/giodamelio/Projects/node-boilerplate/node_modules/zappa/lib/zappa.js:702:4)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (/home/giodamelio/Projects/node-boilerplate/src/app.coffee:3:3)
at Object.<anonymous> (/home/giodamelio/Projects/node-boilerplate/src/app.coffee:52:4)
What happened?
Recently I just had a similar problem with zappa 0.3.3
Apparently the creator of zappa is on vacation and doesn't update to the current versions of node.js, but you may use zappajs instead. It's a fork that is a little more up-to-date.
npm install zappajs
And use require('zappajs') instead of require('zappa').

Resources