phonegap-facebook-plugin giving error :init not called with valid version - phonegap-plugins

I am using https://github.com/Wizcorp/phonegap-facebook-plugin in my application but when i giving error init not called with valid version.
Error
at Object.a (https://connect.facebook.net/en_US/sdk.js:61:150)
at require (https://connect.facebook.net/en_US/sdk.js:24:620)
at require (https://connect.facebook.net/en_US/sdk.js:24:584)
at require (https://connect.facebook.net/en_US/sdk.js:24:584)
at require (https://connect.facebook.net/en_US/sdk.js:24:584)
at require (https://connect.facebook.net/en_US/sdk.js:24:584)
at require (https://connect.facebook.net/en_US/sdk.js:24:584)
at require (https://connect.facebook.net/en_US/sdk.js:24:584)
at __d (https://connect.facebook.net/en_US/sdk.js:24:773)
at Object.<anonymous> (https://connect.facebook.net/en_US/sdk.js:72:1)
below is my config.xml for plugin
<gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.8.0">
<param name="APP_ID" value="<MyAppID>" />
<param name="APP_NAME" value="<My_APP_NAME>" />
</gap:plugin>

Related

Electron UI load native C++ addon on Windows error

I've createed simple native add-on using generator-napi-module. The module is successfully built.
Also, I've added folowing line in window.js:
const testmodule = require('testmodule')
When I start app with npm start, I've got following error:
ELECTRON_ASAR.js:166 Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\Electron\simple-samples-master\activity-monitor\node_modules\testmodule\build\Release\testmodule-native.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
at Module.load (internal/modules/cjs/loader.js:620)
at tryModuleLoad (internal/modules/cjs/loader.js:559)
at Function.Module._load (internal/modules/cjs/loader.js:551)
at Module.require (internal/modules/cjs/loader.js:658)
at require (internal/modules/cjs/helpers.js:20)
at Object.<anonymous> (C:\Electron\simple-samples-master\activity-monitor\node_modules\testmodule\lib\binding.js:1)
at Object.<anonymous> (C:\Electron\simple-samples-master\activity-monitor\node_modules\testmodule\lib\binding.js:6)
The module is working properly when I execute command:
node index
or test with:
npm test
What could go wrong here? Could this be related to security?
Also note that I tried to play with ffi-napi to load native library but the same error message appears.

Private static methods in NodeJS v12.13.0 - syntax error

As described in the JavaScript Reference by Mozilla here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Class_fields#Private_static_methods
This is how private static methods should work:
class Foo {
static #privateStaticMethod() {
return 42;
}
}
However, when using this in NodeJS v12.13.0, the following syntax error is thrown:
static #privateStaticMethod() {
^
SyntaxError: Unexpected token '('
at Module._compile (internal/modules/cjs/loader.js:892:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (.../foo.js:8:14)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
Having a look at the browser compatibility page, private static methods should be supported since v12.
Why is that?
The table states that Private Static fields are supported, not methods.
In node 13.2.0 it's working under --harmony-private-methods flag
[class] implement static private methods was added in v8 7.9. That version of v8 was added to Node 13.2.0
Using the flag, in Node 12.13.0 you won't get a SyntaxError but a TypeError when trying to access the method
TypeError: Read of private field Foo from an object which did not contain the field
v8 issue: Fully implemented behind flag

TypeError: Cannot read property 'onReady' of undefined

When I run node ./myapp.js, I'm getting
(node:14122) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/cjs/loader.js:637
module.reflect.onReady((reflect) => {
^
TypeError: Cannot read property 'onReady' of undefined
at Module.load (internal/modules/cjs/loader.js:637:22)
at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
at Function.Module._load (internal/modules/cjs/loader.js:558:3)
at Module.require (internal/modules/cjs/loader.js:663:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/ecarroll/code/sw/source-water/sw-input/node_modules/psl/index.js:14:19)
at Module._compile (internal/modules/cjs/loader.js:734:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
at Module.load (internal/modules/cjs/loader.js:626:32)
at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
The kicker here is,
(node:14122) ExperimentalWarning: The ESM module loader is experimental.
This and the subsequent type error
TypeError: Cannot read property 'onReady' of undefined
Are caused by the presence of,
NODE_OPTIONS=--experimental-modules
You should undefine that or set it NODE_MODULES="" node ...
If you run Node with --experimental-modules then,
It's important to note here that .mjs isn't only about file extensions. running node with the
--experimental-modules flag also means that ES6 module specifiers must be valid urls, so the extension has to be included in the import statement, e.g. import x from './x.mjs

NodeJS-Electron-msnodesqlv8 - Error while loading binaries in msnodesqlv8

Context: I am building an electron app, which is querying a sql server (remote server) to get the data from table. I am using mssqlnodev8.
Error: When I start the electron app using npm start, I get the below error -
Uncaught Error: None of the binaries loaded successfully. Is your node
version either latest 4, 5, 6, 7, 8 or 9 ?
at failIfNoBinaryExported (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:63)
at Object.liveLoad (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:50)
at Object. (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:79)
at Object. (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:81)
at Module._compile (internal/modules/cjs/loader.js:711)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722)
at Module.load (internal/modules/cjs/loader.js:620)
at tryModuleLoad (internal/modules/cjs/loader.js:559)
at Function.Module._load (internal/modules/cjs/loader.js:551)
at Module.require (internal/modules/cjs/loader.js:658)
Additional information about electron app -
I am using bootstrap for my UI. As per electron faq site, I have the below code in my entry html file
<script>
window.nodeRequire = require;
delete window.require;
delete window.exports;
delete window.module;
</script>
All the modules except electron (index.js - entry point) is imported with
nodeRequire
Analysis done till now -
The javascript logic to connect to database and fetch records are in
separate js file. When I execute the file with 'node file.js', it
works perfectly fine and returns records.
The node version is v9.8.0. Electron version is 3.0.2
I analyzed bootstrap.js file in node_modules\msnodesqlv8\lib\bootstrap.js, line number 63. It traced to below code
var files = require('fs').readdirSync(binaryDir)
I changed that too nodeRequire, but it didnt work.
I have checked similar issues in github but none of the resolutions helped.
UPDATED
I analyzed the bootstrap.js in msnodesqlv8. These are the different error messages
Error while exporting binary Error:
\?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.electron.v2.0.4.ia32.node
is not a valid Win32 application.
\?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.electron.v2.0.4.ia32.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
at Module.load (internal/modules/cjs/loader.js:620)
at tryModuleLoad (internal/modules/cjs/loader.js:559)
at Function.Module._load (internal/modules/cjs/loader.js:551)
at Module.require (internal/modules/cjs/loader.js:658)
at require (internal/modules/cjs/helpers.js:20)
at attemptToExportBinary (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:58)
at C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:48
Error while exporting binary Error: The module
'\?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.electron.v2.0.4.x64.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 57. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing the
module (for instance, using npm rebuild or npm install).
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
at Module.load (internal/modules/cjs/loader.js:620)
at tryModuleLoad (internal/modules/cjs/loader.js:559)
at Function.Module._load (internal/modules/cjs/loader.js:551)
at Module.require (internal/modules/cjs/loader.js:658)
at require (internal/modules/cjs/helpers.js:20)
at attemptToExportBinary (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:58)
at C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:48
Error while exporting binary Error:
\?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.node.v10.8.0.ia32.node
is not a valid Win32 application.
\?\C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bin\sqlserverv8.node.v10.8.0.ia32.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
at Module.load (internal/modules/cjs/loader.js:620)
at tryModuleLoad (internal/modules/cjs/loader.js:559)
at Function.Module._load (internal/modules/cjs/loader.js:551)
at Module.require (internal/modules/cjs/loader.js:658)
at require (internal/modules/cjs/helpers.js:20)
at attemptToExportBinary (C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:58)
at C:\Users\t9sau2\Documents\NodeJs\Renewalverification\node_modules\msnodesqlv8\lib\bootstrap.js:48
I had raised this issue in github report of msnodesqlv8. The owner updated the version, which resolved the issue. github link - https://github.com/TimelordUK/node-sqlserver-v8/issues/80

Sails fails to lift

On giving the sails lift command I get the following error. The command was working a few moments ago and has stopped working all of a sudden
error: A hook (`controllers`) failed to load!
error: SyntaxError: Unexpected string
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at C:\Users\All Users\AppData\Roaming\npm\node_modules\sails\node_modules\include-all\index.js:129:29
at Array.forEach (native)
at requireAll (C:\Users\All Users\AppData\Roaming\npm\node_modules\sails\node_modules\include-all\index.js:44:9)
at buildDictionary (C:\Users\All Users\AppData\Roaming\npm\node_modules\sails\node_modules\sails-build-dictionary\index.js:68:14)
at Function.module.exports.optional (C:\Users\All Users\AppData\Roaming\npm\node_modules\sails\node_modules\sails-build-dictionary\index.js:160:9)
at Hook.loadControllers (C:\Users\All Users\AppData\Roaming\npm\node_modules\sails\lib\hooks\moduleloader\index.js:313:23)
at Hook.wrapper [as loadControllers] (C:\Users\All Users\AppData\Roaming\npm\node_modules\sails\node_modules\lodash\index.js:3095:19)
at Hook.loadAndRegisterControllers (C:\Users\All Users\AppData\Roaming\npm\node_modules\sails\lib\hooks\controllers\to-load-and-register-controllers.js:33:19)
at Hook.initialize (C:\Users\All Users\AppData\Roaming\npm\node_modules\sails\lib\hooks\controllers\index.js:59:12)
you have to fix your syntax error in registerControllers.js line 33
Without your code it's difficult to say. There is likely an error at your controller call. Check your quotes, maybe you put two quotes like this :
ng-controller=""mycontroller" <!-- error -->
or
ng-controller='my_controller" <!-- error -->
or simply a random character you may have written inadvertently on a random location of your file. In that case, and at the condition you developed your project using a version control system (git, svn) you can display your recent modification since your last commit by doing the command git(or svn) diff at the root of your project.
You can see error details with running your project
sails lift --silly

Resources