I have deployed a js application on heroku that uses meteor. The build works on localhost but fails on the heroku server. I checked the logs and found this:
.js:312:12)
2017-03-18T03:29:07.070711+00:00 app[web.1]: const unicodeNormalizePath = (path) => {
2017-03-18T03:29:07.074825+00:00 app[web.1]: at Module.require (module.js:364:17)
2017-03-18T03:29:07.074821+00:00 app[web.1]: SyntaxError: Unexpected token >
2017-03-18T03:29:07.074824+00:00 app[web.1]: at Module.load (module.js:356:32)
2017-03-18T03:29:07.070741+00:00 app[web.1]: ^
This gave me the thought that it was not compatible with ES6 arrow functions so I installed ecmascript for meteor to make it compatible with ES5.
This has not solved the problem and this arrow function is still crashing the web app.
Any suggestions on how to stop this?
I had the same problem using, probably, an old buildpack for Heroku. I switched to the buildpack https://github.com/AdmitHub/meteor-buildpack-horse.git and it solved the problem perfectly.
Working buildpack:
heroku buildpacks:set https://github.com/AdmitHub/meteor-buildpack-horse.git
I also disabled the previous buildpack by typing:
heroku config:unset LINK_TO_OLD_BUILDPACK_REPO
The old one I used was https://github.com/jordansissel/heroku-buildpack-meteor.git
May be you can use babel to transform es6 to es5
Related
I am finishing some backend tutorials and when i tried to install Sequelize with Node this is what it displays on the screen i have tried to downgrade the versions of Node js to solve the problem and updated other dependencies but it doesnt work, i am currently using 8.4.0 Node version, the one that is used on the tutorial and the lesson but it doesnt fix the issue, hope you can help me with this so i can move on to finish my course and do the exam, here it is what i get after trying to install:
P.D. I am working on a OS Windows 10 desktop computer.
C:\Users\AIO 330-20AST\Desktop\backend\base_datos> node server.js
node-pre-gyp info This Node instance does not support builds for N-API version 3
node-pre-gyp info This Node instance does not support builds for N-API version 6
C:\Users\AIO 330-20AST\Desktop\backend\base_datos\node_modules\node-pre-gyp\lib\util\napi.js:84
throw new Error(
^
Error: The N-API version of this Node instance is 1. This module
supports N-API version(s) 3,6. This Node instance cannot run this
module.
at Object.module.exports.validate_package_json (C:\Users\AIO
330-20AST\Desktop\backend\base_datos\node_modules\node-pre-gyp\lib\util\napi.js:84:9)
at Object.validate_config (C:\Users\AIO
330-20AST\Desktop\backend\base_datos\node_modules\node-pre-gyp\lib\util\versioning.js:229:10)
at Object.exports.find (C:\Users\AIO
330-20AST\Desktop\backend\base_datos\node_modules\node-pre-gyp\lib\pre-binding.js:21:15)
at Object.<anonymous> (C:\Users\AIO
330-20AST\Desktop\backend\base_datos\node_modules\sqlite3\lib\sqlite3-binding.js:3:27)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
C:\Users\AIO 330-20AST\Desktop\backend\base_datos>
For your help thanks in advance, good coding!
I can't get this tutorial to work (running on Ubuntu v19.04):
https://www.apollographql.com/docs/apollo-server/getting-started/
My code is literally copy+pasted from the tutorial - I have installed all dependencies, and I keep getting the following error when running node index.js:
internal/modules/cjs/loader.js:628
throw e;
^
Error: No valid exports main found for '{project-path}/node_modules/uuid'
at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)
at applyExports (internal/modules/cjs/loader.js:502:14)
at resolveExports (internal/modules/cjs/loader.js:551:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)
at Function.Module._load (internal/modules/cjs/loader.js:855:27)
at Module.require (internal/modules/cjs/loader.js:1033:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> ({project-path}/project-myra/node_modules/apollo-engine-reporting/dist/agent.js:26:16)
at Module._compile (internal/modules/cjs/loader.js:1144:30) {
code: 'MODULE_NOT_FOUND'
This is literally so frustrating, because the only place to get any help with apollo-server is from a Spectrum chat that keeps disconnecting, and doesn't even allow me to create any posts...
Why is this library the official supported and recommended library for GraphQL? And how come I seem to be the only person in the world having this issue, I can't find anyone else asking about this...
It seems it's a problem with the current Apollo Server version.
Try downgrading to 2.6.3, this worked for me. Haven't tried with any other version though.
npm install apollo-server#2.6.3
I am running this code when I run node index.js command in CMD it works perfectly but same code is not running when I am using it into firebase cloud function. I might be wrong but not able to find the issue I am searching this issue for 1 week.
this code is working
stripe.customers.create({
email: 'testemail#gmail.com',
}).then((customer) => {
return null;
// functions.firestore.document('data/{card}/payment/{tokenid}').set(customer.id)
});
but this is not working
exports.StripeSource =functions.firestore.document('data/{card}/tokens/{tokenid}').onCreate((user) => {
return stripe.customers.create({
email: 'testemail#gmail.com',
}).then((customer) => {
return null;
// functions.firestore.document('data/{card}/payment/{tokenid}').set(customer.id)
});
});
fire base functions log is
{"#type":"type.googleapis.com/google.cloud.audit.AuditLog","status":
{"code":3,"message":"INVALID_ARGUMENT"},"authenticationInfo":
{"principalEmail":"name.dev#domain.tv"},"requestMetadata":{"requestAttributes":
{},"destinationAttributes":
{}},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.fun
ctions.v1.CloudFunctionsService.UpdateFunction","resourceName":"projects/payment
bystripe/locations/us-central1/functions/StripeSource"}
visual studio code terminal report here
C:\Users\Waqas\AndroidStudioProjects\flutter_stripe_payment1\android\functions\functions>firebase deploy --only functions
=== Deploying to 'paymentbystripe'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions# lint C:\Users\Waqas\AndroidStudioProjects\flutter_stripe_payment1\android\functions\functions
> eslint .
+ functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
+ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (37.28 KB) for uploading
+ functions: functions folder uploaded successfully
i functions: updating Node.js 8 function StripeSource(us-central1)...
! functions[StripeSource(us-central1)]: Deployment error.
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'stripe'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/srv/index.js:5:16)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
Functions deploy had errors with the following functions:
StripeSource
To try redeploying those functions, run:
firebase deploy --only functions:StripeSource
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
C:\Users\Waqas\AndroidStudioProjects\flutter_stripe_payment1\android\functions\functions>
You did not install stripe. I recommend you to look your dependencies in package.json and add "stripe":"^6.20.0". Any new version of this will do the trick.
Finally run Firebase deploy. I hope this helps.
This error means the deployment script could not find the stripe package. You probably have the stripe module installed globally but it is not referenced explicitly in your package.json for this project.
When you deploy firebase function the deployment script takes your package.json and pulls all of the dependencies. It will not look for dependencies installed locally on your machine.
Either add the stripe dependency manually to the package.json or run:
npm install stripe
then verify the stripe module has been added to your package.json file.
How can i Fix my error. i need to display a pdf from my assets folder. im using expo, react native, react-native-pdf
Scanning folders for symlinks in C:\Users\kjdelacruz\mobile\cdo-mobile-organizer\node_modules (31ms)
RNFetchBlob checking app version ..
RNFetchBlob detected app version => 6
Add Android permissions => false
react-native-fetch-blob link FAILED
Could not automatically link package :TypeError: path must be a string or Buffer
at Object.fs.readFile (fs.js:358:11)
at Object.<anonymous> (C:\Users\kjdelacruz\mobile\cdo-mobile-organizer\node_modules\react-native-fetch-blob\scripts\prelink.js:29:8)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3please follow the instructions to manually link the library : https://github.com/wkh237/react-native-fetch-blob/wiki/Manually-Link-Package
rnpm-install info Linking assets to ios project
rnpm-install ERR! Something went wrong while linking. Error: Cannot read property 'pbxprojPath' of null
Please file an issue here: https://github.com/facebook/react-native/issues
Cannot read property 'pbxprojPath' of null
Apparently rn-fetch-blob is incompatible with expo. I have dealt with this very problem before with expo and rn-fetch-blob.
"It doesn't work with Expo because Expo doesn't support native module linking. Like you said you'll have to detach from Expo in order to run react-native link react-native-fetch-blob for this to work."
https://docs.expo.io/versions/latest/guides/detach.html
You will need to use XCode to get it working.
There are a couple threads discussing. No solutions with expo though.
https://github.com/joltup/rn-fetch-blob/issues/97
https://github.com/wkh237/react-native-fetch-blob/issues/371
Currently i'm successfully managing some PHP deamons (single instance) with PM2, and, so far so good!
With PM2 and while managing Node.js/IO.js apps, i can launch them in cluster mode on PM2 with no stress! The same does not happen with the mentioned php deamons!
So, first of all, is it even possible to manage/launch clustered instances of a PHP script using PM2 (or is that PM2 feature only usable on Node.js/IO.js scripts)?
If so (possible to do), what special "tuneups" are required to cluster the PHP scripts with PM2!?
While trying to launch some pm2 start xxx.php -i 2 --name XXX, i get the following error # the error log path:
SyntaxError: Unexpected token <
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function._load (/usr/local/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
at /usr/local/lib/node_modules/pm2/lib/ProcessContainer.js:200:23
at /usr/local/lib/node_modules/pm2/node_modules/async/lib/async.js:52:16
at /usr/local/lib/node_modules/pm2/node_modules/async/lib/async.js:1209:30
at WriteStream.<anonymous> (/usr/local/lib/node_modules/pm2/lib/Utility.js:126:13)
at WriteStream.EventEmitter.emit (events.js:95:17)
... that makes me believe that it can't even parse the given PHP file!
Thanks in advance for any help on this!
Short answer: you can't use cluster mode with php.
The pm2 cluster mode only works with javascript. Internally it's using the nodejs cluster module and requiring your script (code line).
This also explains your error, pm2 tries to execute the php code with javascript (hence the SyntaxError).
When using fork mode, it's using your interpreter (here php) to launch the script. This is why you can also run python or ruby on top of nodejs!