3

I'm trying to add gm module to my cloud. Since parse is not a node.js environment I made small changes over other modules I used, but gm module requires so much node core module. Do I have to push all of the sub modules to parse. Also how can I add the core modules. Changing require('xxx') to require('xxx/index.js') or require('xxx/xxx.js') failed.

These are the modules I could find where gm is depended and changed these files. I did include all the files in the modules only changed the following ones.

 - gm/index.js
   - events/events.js
   - util/util.js
   - stream/index.js
      - emitter/index.js (also depends on util)
        - asynclist/index.js 
          - eventproxy/index.js

changing all of these gives error

Result: Error: Module ./lib/eventproxy not found
    at libs/eventproxy/index.js:1:18
    at libs/asynclist/index.js:1:18
    at libs/emitter/index.js:1:17
    at libs/stream/index.js:22:15
    at libs/gm/index.js:6:14
    at main.js:118:14

// This error is caused by ./lib/eventproxy.  
// It must be cloud/libs/asynclist/node_modules/eventproxy/lib/eventproxy.js
// Parse doesn't recognize './' as this folder in cloud code

where gm/index.js's require part is

var Stream = require('cloud/libs/stream/index.js').Stream;
var EventEmitter = require('cloud/libs/events/events.js').EventEmitter;
var util = require('cloud/libs/util/util.js');

My cloud folder structure is

cloud/libs/gm
cloud/libs/events  
cloud/libs/util  
cloud/libs/stream  
cloud/libs/emitter  
cloud/libs/asynclist 
cloud/libs/eventproxy  

EDIT: I found more dependencies. According to this, gm has 36 dependent libraries and I clearly need a simple solution.

EDIT: for the relative path problem with parse, this is a solution but as I said I need a simple way for the whole problem.

Thellimist
  • 3,757
  • 5
  • 31
  • 49
  • Your cloud should do `npm install` command which would download all the modules and install it properly. I would not recommend copying `node_modules` folder from your computer to a cloud instance. – Vasyl Boroviak Mar 19 '15 at 00:44
  • Use LWIP for image manipulation if possible: http://thejackalofjavascript.com/image-manipulation-node-js/ – Vasyl Boroviak Mar 19 '15 at 00:46
  • I'm not sure if Parse allows me to do that. I searched and couldn't find anything that should work related to your suggestion. – Thellimist Mar 19 '15 at 00:47
  • You should ask the cloud provider how to do this task. Reach their support. – Vasyl Boroviak Mar 19 '15 at 00:48
  • @VasiliyBorovyak I checked LWIP it's pretty nice but it doesn't have drawText feature. I searched the web but couldn't find Image manipulation nodejs library which has almost none dependencies. Do you have any other suggestions. Core features I need is crop, paste, drawText. – Thellimist Mar 22 '15 at 01:06

0 Answers0