npm installation modules on parse cloud code

724 views
Skip to first unread message

dhei...@umich.edu

unread,
Jul 25, 2016, 12:31:48 PM7/25/16
to back{4}app
Hello. I am trying to run a javascript file that uses requires a node.js module installation. Is it possible to run npm install on the parse cloud code?

Davi Macêdo

unread,
Jul 26, 2016, 1:04:46 AM7/26/16
to back{4}app
Not yet. But it will be possible soon. What is the module you need? We have the following already installed to all apps running on back4app:

If you need any additional one, reach us on web-site chat and we will install for you.

Best!

Davi Macêdo

unread,
Jul 26, 2016, 12:17:45 PM7/26/16
to back{4}app
For Braintree module, for instance. is it already installed. Just require('baintree') and use following its own docs:


We also have other topic in developers group you can follow:

cha...@back4app.com

unread,
Jan 25, 2018, 5:29:35 PM1/25/18
to Back4App
Hi!

Now, it's possible to install a npm module on the cloud code! :D

Please, take a look in this link, it will help you about it.

Regards,
Charles Ramos

Tim Loewel

unread,
Feb 21, 2018, 7:38:47 AM2/21/18
to Back4App

Does this really work?

We are using some custom packages and get in our log:

Error: Cannot find module 'archiver' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17)

the package.json in cloud folder:  
"dependencies": {
    "archiver": "^2.1.0",
    "async": "^2.6.0",
    "fs": "^0.0.1-security",
    "path": "^0.12.7",
    "request-promise-native": "^1.0.5",
    "rimraf": "^2.6.2"
  }
}

 So it seems as if the package was not installed..

I would be grateful for advice..

thanks, Tim

cha...@back4app.com

unread,
Mar 5, 2018, 6:33:22 PM3/5/18
to Back4App
Hi Tim,

Could you please send us your app ID to check it?

You can email us for that, our email address is comm...@back4app.com.

Regards,
Charles Ramos

Tim Loewel

unread,
Mar 6, 2018, 1:20:55 PM3/6/18
to Back4App
Hi
thanks for your help
app id:
RZxPuQJo7SlrnTdSJTzw9bhLn1spbX6KXK8pFHP3

It works after a while after several restarts or uploading the package.json via cloud codevweb interface.
but of course that is not reliable enough for a production server.

Best, Tim



--
You received this message because you are subscribed to a topic in the Google Groups "Back4App" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/back4app/sgNnvUoqAZg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to back4app+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/back4app/e1760b9c-6b06-45bf-9a8c-86ada30e11b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

cha...@back4app.com

unread,
Mar 6, 2018, 6:38:34 PM3/6/18
to Back4App
Hi Tim,

Okay, good to know it's working now.

If you face this issue again, please, let us know and we will take a look on it. (:

Regards,
Charles Ramos
To unsubscribe from this group and all its topics, send an email to back4app+u...@googlegroups.com.

Tim Loewel

unread,
Mar 13, 2018, 6:54:45 AM3/13/18
to Back4App

that "it is working" is not what I meant.

Whenever we do a deploy the website is down.
Then I frenetically do a redeploy after the other and restart the app and upload the package.json
and add in a few hopes and prayers..
..until the website is up again.

This works now, where we have very few users. But once we are scaling up this is unacceptable.

Did you look at the logs? I had the impression that there was a dead npm process in your system that
locked out our install.

Is there anything I can do to help you find the problem?

I think I will do an install today. I will try to contact support via the webchat, if the problem
is still there.
Or do you have a slack or skype where I could reach you, so we can debug it together?

Thanks, Tim

Tim Loewel

unread,
Mar 13, 2018, 7:18:12 AM3/13/18
to Back4App
Suddenly our webapp is not working any more. A package in package.json is suddenly missing.
No one on my team remembers restarting the server or deploying.

Error: Cannot find module 'archiver'
    at
Function.Module._resolveFilename (module.js:325:15)
    at
Function.Module._load (module.js:276:25)
    at
Module.require (module.js:353:17)
    at
require (internal/module.js:12:17)

    at
Object.<anonymous> (/usr/src/app/data/cloud/routers/downloadRouter.js:10:16)
    at
Module._compile (module.js:409:26)
    at
Object.Module._extensions..js (module.js:416:10)
    at
Module.load (module.js:343:32)
    at
Function.Module._load (module.js:300:12)

    at
Module.require (module.js:353:17)
    at
require (internal/module.js:12:17)

My guess is, that b4a moved our code to a different server and restarted it automatically.
Which is fine by me.
But as a restart does not guarantee the package.json to be installed suddenly a package
that our code relies on does not exist any more.

We are now redeploying and restarting the app and reuploading the package.json
but the server does not seem to want to install the packages.

This is really no good situation. Before it was just that we had a one hour outage with every
deploy.  But now it seems as if the server could be down any moment by itself.

This is really unbearable.

Please help.

Best, Tim

matrpe...@gmail.com

unread,
Mar 15, 2018, 10:21:32 PM3/15/18
to Back4App
I have the same issue and this has happened multiple times before. This problem is literally causing me right now to lose a lot of money. This should not happen for a production enviroment.

Fri Mar 16 2018 02:19:19 GMT+0000 (UTC)
Cloud Code not loaded:
 
Error: Cannot find module 'moment-range'

    at
Function.Module._resolveFilename (module.js:325:15)
    at
Function.Module._load (module.js:276:25)
    at
Module.require (module.js:353:17)
    at
require (internal/module.js:12:17)

    at
Object.<anonymous> (/usr/src/app/data/cloud/Utils/horarios_back.js:7:19)

    at
Module._compile (module.js:409:26)
    at
Object.Module._extensions..js (module.js:416:10)
    at
Module.load (module.js:343:32)
    at
Function.Module._load (module.js:300:12)
    at
Module.require (module.js:353:17)

Em segunda-feira, 25 de julho de 2016 13:31:48 UTC-3, dhei...@umich.edu escreveu:
Message has been deleted
Message has been deleted

Lucas Verra

unread,
Apr 22, 2019, 1:47:51 AM4/22/19
to Back4App
same experience , we opened #5233 ticket on that matter. 

Some library we've always used is now "cannot find module". Weird and unreliable if you ask me. 

Lucas Verra

unread,
Apr 22, 2019, 1:17:20 PM4/22/19
to Back4App
for next who has issue, support has responded 

Hi Lucas, 
thanks for reaching out!
At the moment, can you please remove the modules parse and parse-server from your package.json?
Then, upload your changes using b4a deploy.
After this change, please let us know =D
Reply all
Reply to author
Forward
0 new messages