iOS push notifications using Node.js - ios

I am writing the Node server code for sending push notifications to an iOS device. when I run my code, it produces the error below. Has anyone seen this before or know how to handle it? If it helps give some context, I am using the 'apagent' node module. Thank you!
crypto.js:145
c.context.loadPKCS12(pfx);
^
Error: Unable to load BIO
at Object.exports.createCredentials (crypto.js:145:17)
at Object.exports.connect (tls.js:1320:27)
at Agent.connect (/Projects/api/node_modules/apnagent/lib/apnagent/agent/live.js:113:17)
at Object.<anonymous> (/Projects/api/agent/_header.js:16:7)
at Module._compile (module.js:456:26)
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 Module.require (module.js:364:17)
at require (module.js:380:17)

Related

Got "Module did not self-register" error. when tried to added msnodesqlv8 module in electron

I got error when I had added msnodesqlv8 module in electron.
Uncaught Error: Module did not self-register.
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
at Object.Module._extensions..node (module.js:598:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at connectionModule (C:\Users\Gaurav\Documents\Electron Example\DesktopApplication\node_modules\msnodesqlv8\lib\connection.js:10:21)
at Object.<anonymous> (C:\Users\Gaurav\Documents\Electron Example\DesktopApplication\node_modules\msnodesqlv8\lib\connection.js:450:3)
I have try to connect my electron code to mssql with windows authentication. So I have added msnodesqlv8 module. But i got error in this line
var sql = require("mssql/msnodesqlv8");
Is there any way to solve this problem?

async function run() { ^^^^^^^^ SyntaxError: Unexpected token function

After upgrading my react native app to version 0.59.8 i made it work on android but when trying to build it and run in on ios it shows me this error :
node_modules/react-native/node_modules/#react-native-community/cli/build/cliEntry.js:168
async function run() {
^^^^^^^^
SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous>
Even when doing react-native info or react-native start or react-native run-ios , it shows the same error ,
Do you Know please what does it mean this error ?
Async functions are not supported in your version of Node. You really only have two options.
To install Babel, to compile the javascript in a way that can be understood (transpiled)
Upgrade your version of Node
I would HIGHLY recommend to upgrade Node.
How to upgrade node:
https://www.surrealcms.com/blog/how-to-upgrade-or-downgrade-nodejs-using-npm.html
EDIT
I've just come across this SO post from #Quentin - which explains this better. (Kudos) so, I thought I'd include
SyntaxError: Unexpected token function - Async Await Nodejs

Issue with appmetrics-dash module while using node:8-alpine docker file

This is the error below i am getting while executing my node app inside a docker container with the base image as node:8-alpine
throw err;
^
Error: Cannot find module 'appmetrics-dash'
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> (/app/proxyapp/proxyapp.js:3:1)
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)
Alpine linux was not a supported platform:
https://github.com/RuntimeTools/appmetrics-dash/issues/139
But their team is working now about it https://github.com/RuntimeTools/appmetrics/issues/582

can not setup main.js file on google cloud parse

I'm trying to setup a parse on google cloud but can't setup the cloud/main.js file
add cloud link on server.js
cloud: "/opt/bitnami/apps/parse/htdocs/cloud/main.js",
I got the following error:
SyntaxError: Unexpected token )
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at new ParseServer (/opt/bitnami/apps/parse/htdocs/node_modules/parse-server/lib/ParseServer.js:159:9)
error: Forever detected script exited with code: 1
When editing the ‘server.js’ file in ‘/opt/bitnami/apps/parse/htdocs/’ folder, make sure the ‘cloud’ folder exists and try setting the ‘cloud’ field string to “./cloud/main.js” to point to main.js file in cloud folder, the error could be related to incorrect path. If you are looking to add custom code to the Parse server, please follow the steps provided here [1].
[1] https://docs.bitnami.com/google/apps/parse/#how-to-add-your-custom-cloud-code-to-your-parse-server-stack

phonegap platform add ios - "Unexpected token =>" error

I have a Phonegap app and need to build it in a Mac. Everything works in a machine and I'm trying to configure a new one, but on this, when I run phonegap platform add ios I receive the following error:
$ phonegap platform add ios
/usr/local/lib/node_modules/phonegap/lib/phonegap/util/connect-proxy.js:21
fs.readFile(settings, (err, data) => {
^^
SyntaxError: Unexpected token =>
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/usr/local/lib/node_modules/phonegap/lib/phonegap/serve.js:9:23)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Both Macs are running with node v0.12.7 and npm 2.11.3.
Apparently phonegap is using ECMAScript 6 Features like Arrow Functions.
I think this is resulting into your error, because you are still using Node v0.12.7, which does not support these features. Installing the latest LTS version from Official Node.js should fixed that.
For further information please have a look at the phonegap requirements.
Please update your node and npm version to solved your problem.

Resources