Node module install issue with Parse Server

237 views
Skip to first unread message

Alex inVR

unread,
May 7, 2018, 3:22:00 PM5/7/18
to NodeChef

Hi, I'm trying to install the 'axios’, ‘ipware’ and ‘node-persist’ modules and I keep getting the error below (module not found).  I had a similar issue with the ‘sendgrid’ module earlier, but that was fixed on your end.  I also have the 'patreon' module installed and that seems to be loading correctly.  Are we supposed to be able to load any npm module that we like, or are there some limitations?  I’m using Parse Server v2.4.2, Node.js v7.10.1 and NPM v5.8.0.  I’ve attached my package.json and package-lock.json files to this message.


Here is a link to my zipped node_modules folder, since the file appears to be too big to attach to this post (872 KB):

http://alexk.net/uploads/node_modules.zip


Thanks,

Alex

inVR



App1_test module.js:472 

throw err; 


Error: Cannot find module 'axios' 

at Function.Module._resolveFilename (module.js:470:15) 

at Module.require (module.js:498:17) 

at require (internal/module.js:20:19) 

at Object.<anonymous> (/bundle/cloud/cloud_code/nats.js:25:15) 

at Module._compile (module.js:571:32) 

at Object.Module._extensions..js (module.js:580:10) 

at Module.load (module.js:488:32) 

at tryModuleLoad (module.js:447:12) 


at Function.Module._load (module.js:439:3)

package-lock.json
package.json

in...@nodechef.com

unread,
May 8, 2018, 5:20:47 AM5/8/18
to NodeChef
What version of node.js are you using locally?

al...@sinvr.co

unread,
May 8, 2018, 1:58:26 PM5/8/18
to NodeChef

I’m using Node.js v7.10.1 locally, same as I’m using on NodeChef.  I’m also using npm v5.8.0, which came installed with Node v7.10.1.  I tried updating npm to v6.0.0 and that version still had this same issue.  I also tried the most recent version of ‘yarn’ instead of ’npm’ to install the packages and that didn’t fix anything either.  Thanks for looking into this.

al...@sinvr.co

unread,
May 10, 2018, 3:57:37 PM5/10/18
to NodeChef
Hi, would you happen to have any updates on the progress regarding this issue?  I replied to your question two days ago, please see my previous response.  

Thanks, 
Alex
inVR

in...@nodechef.com

unread,
May 10, 2018, 10:50:44 PM5/10/18
to NodeChef
Hi, Matt will provide an update on this tmr. Thanks

in...@nodechef.com

unread,
May 11, 2018, 7:11:31 AM5/11/18
to NodeChef
Your current package.json does not contain the module axios: 0.18.0. Can you attempt deploying again with this module included and advice when you have done so.

al...@sinvr.co

unread,
May 11, 2018, 6:33:05 PM5/11/18
to NodeChef
OK, I installed the node modules 'axios' and 'node-persist' on our app instance called 'test'.  Those are two that give me the 'Cannot find module' error when I try to load them using a Javascript command such as 'const axios = require('axios');'.  I tried adding the node_modules folder to the path and that didn't work either.  Here is the current package.json file (also including the 'sendgrid' and 'request' modules, with lots of dependencies):

{"name":"test","description":"Parse Server cloud code modules","main":"main.js","dependencies":{"is-windows":"0.2.0","form-data":"2.3.2","jsprim":"1.4.1","mime":"1.6.0","sshpk":"1.14.1","sendgrid-rest":"2.4.0","uuid":"3.2.1","async.util.restparam":"0.5.2","unc-path-regex":"0.1.2","aws-sign2":"0.7.0","bottleneck":"1.16.0","asn1":"0.2.3","caseless":"0.12.0","oauth-sign":"0.8.2","assert-plus":"1.0.0","async.util.arrayeach":"0.5.2","qs":"6.5.2","sntp":"2.1.0","tunnel-agent":"0.6.0","combined-stream":"1.0.6","ms":"2.0.0","async.queue":"0.5.2","async.util.isarray":"0.5.2","minimist":"0.0.8","async.util.noop":"0.5.2","delayed-stream":"1.0.0","encoding":"0.1.12","is-unc-path":"0.1.2","json-schema-traverse":"0.3.1","sendgrid":"5.2.3","asynckit":"0.4.0","extend":"3.0.1","mimelib":"0.3.1","mkdirp":"0.5.1","fast-json-stable-stringify":"2.0.0","punycode":"1.4.1","har-schema":"2.0.0","isstream":"0.1.2","har-validator":"5.0.3","hawk":"6.0.2","stringstream":"0.0.5","cryptiles":"3.1.2","tweetnacl":"0.14.5","addressparser":"1.0.1","request":"2.85.0","bcrypt-pbkdf":"1.0.1","follow-redirects":"1.4.1","tough-cookie":"2.3.4","uue":"3.1.2","boom":"4.3.1","is-relative":"0.2.1","mailparser":"0.6.2","performance-now":"2.1.0","is-buffer":"1.1.6","json-schema":"0.2.3","mime-types":"2.1.18","extsprintf":"1.3.0","mime-db":"1.33.0","async.ensureasync":"0.5.2","async.util.onlyonce":"0.5.2","forever-agent":"0.6.1","safer-buffer":"2.1.2","is-typedarray":"1.0.0","node-persist":"3.0.0","hoek":"4.2.1","http-signature":"1.2.0","lodash.chunk":"4.2.0","async.util.ensureasync":"0.5.2","debug":"2.6.9","jsbn":"0.1.1","escape-string-regexp":"1.0.5","ecc-jsbn":"0.1.1","async.util.map":"0.5.2","async.util.queue":"0.5.2","is-absolute":"0.2.6","json-stringify-safe":"5.0.1","ajv":"5.5.2","co":"4.6.0","core-util-is":"1.0.2","iconv-lite":"0.4.23","async.util.setimmediate":"0.5.2","verror":"1.10.0","dashdash":"1.14.1","getpass":"0.1.7","fast-deep-equal":"1.1.0","axios":"0.18.0","aws4":"1.7.0","safe-buffer":"5.1.2"}}

in...@nodechef.com

unread,
May 13, 2018, 3:27:09 PM5/13/18
to NodeChef
So i finally got to looking into this, i uploaded just the package.json and also your main.js file alone from the dashboard and it actually did install the module axios as can be seen in the node_modules folder if you were to use the cloud code browser under App actions.

A few things, can you advice which CLI you are using. The legacy Java CLI or the new node.js CLI?

Try this, simply zip the contents of your cloud folder without your local node_modules folder and then upload your the zipped file from the dashboard under App actions > Cloud code. Can you then advice if the issue persists?


Alex inVR

unread,
May 15, 2018, 2:37:02 AM5/15/18
to NodeChef

Thanks for the reply.  It turns out that I was using the legacy Java CLI, as I didn't realize that there was a new node.js CLI.  Switching to the new node.js CLI fixed my issue and I’m now able to use the ‘axios’ and ‘node-persist’ node modules.


Since this issue was resolved, I tried removing the ‘request’ node module from my project (as I’m now using ‘axios’ instead), but after doing so and reinstalling the ‘sendgrid’ and ‘axios’ modules, I now get the following error when attempting to deploy my cloud code using the new CLI:


/usr/local/lib/node_modules/nodechef-cli/Commands/deploy.js:402

                var files = fs.readdirSync(base_dir), dependencies = {}, has_module = false;

                                           ^


ReferenceError: base_dir is not defined

    at DeployCloudCode (/usr/local/lib/node_modules/nodechef-cli/Commands/deploy.js:402:44)

    at /usr/local/lib/node_modules/nodechef-cli/Commands/deploy.js:914:13

    at Request._callback (/usr/local/lib/node_modules/nodechef-cli/remotecommon.js:53:13)

    at Request.self.callback (/usr/local/lib/node_modules/nodechef-cli/node_modules/request/request.js:186:22)

    at emitTwo (events.js:106:13)

    at Request.emit (events.js:194:7)

    at Request.<anonymous> (/usr/local/lib/node_modules/nodechef-cli/node_modules/request/request.js:1163:10)

    at emitOne (events.js:96:13)

    at Request.emit (events.js:191:7)

    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/nodechef-cli/node_modules/request/request.js:1085:12)



in...@nodechef.com

unread,
May 15, 2018, 8:44:11 AM5/15/18
to NodeChef
You are right. just run "npm install -g nodechef-cli" again to update the CLI.
Reply all
Reply to author
Forward
0 new messages