transaction code "require('#arangodb').db;" can't be packaged - arangodb

zeit-pkg is a tool for package nodejs code. zeit-pkg also support require('arangojs'). But zeit-pkg returned error for meet const db = require('#arangodb').db; zeit-pkg returns error.
> Error! TypeError: Cannot read property '0' of null
at shortFromAlias (/usr/local/lib/node_modules/pkg/lib-es5/walker.js:69:49)
at Walker._callee5$ (/usr/local/lib/node_modules/pkg/lib-es5/walker.js:894:25)
at tryCatch (/usr/local/lib/node_modules/pkg/node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/pkg/node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/pkg/node_modules/regenerator-runtime/runtime.js:114:21)
at step (/usr/local/lib/node_modules/pkg/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /usr/local/lib/node_modules/pkg/node_modules/babel-runtime/helpers/asyncToGenerator.js:30:13
at <anonymous>
I want to know what's particular in require('#arangodb').db. It's whether any replacement method exists for writing transaction. Or any other package tools can support require('#arangodb').db;

zeit-pkg is compiles JavaScript code into an executable, this is not compatible with Foxx, as Foxx is the executable that runs your JavaScript code.
If you want to minimize/uglify/mangle your code take a look at WebPack, this document from ArangoDB shows you how to get WebPack working with Foxx, as it marks those libraries as 'external' libraries that get skipped for processing.

Related

when using create-react-app; I get Compiling RuleSet failed Error when running npm start. Query arguments on 'loader' has been removed

While setting up my dev environment for react, I've become unable to get a server to run. I've done fresh re-installs of npm, node, create-react-app, and I get thrown the same error everytime I run npm start.
/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/react-scripts/scripts/start.js:19
throw err;
^
Error: Compiling RuleSet failed: Query arguments on 'loader' has been removed in favor of the 'options' property (at ruleSet[1].rules[0].loader: /Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/source-map-loader/dist/cjs.js)
at RuleSetCompiler.error (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:373:10)
at /Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/UseEffectRulePlugin.js:160:29
at Hook.eval [as call] (eval at create (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:49:1)
at RuleSetCompiler.compileRule (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:177:19)
at /Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:154:9
at Array.map (<anonymous>)
at RuleSetCompiler.compileRules (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:153:16)
at RuleSetCompiler.compileRule (/Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:184:30)
at /Users/sophiamatthews/Desktop/Coding?/7-react-tutorial/node_modules/webpack/lib/rules/RuleSetCompiler.js:154:9
at Array.map (<anonymous>)
This is being done on a new machine that hasn't had any developer tools installed previously.
Not a Duplicate of Error: Compiling RuleSet failed: Query arguments on 'loader' has been removed in favor of the 'options' property
My error occurs in a different file that has a different structure.
7-react-tutorial/node_modules/source-map-loader/dist/cjs.js looks as such
"use strict";
const loader = require("./index");
module.exports = loader.default;
module.exports.raw = loader.raw;

**ERROR! Callback called multiple times** JHipster version 7.3.1 (latest) having Error in Node

I have used other versions of JHipster but that one in my mac is not working fine, I am trying to generate a simple gateway (no entities yet), and after executing:
$jhipster
Filling the application metadata, I just got:
ERROR! Callback called multiple times
Error [ERR_MULTIPLE_CALLBACK]: Callback called multiple times
at NodeError (node:internal/errors:371:5)
at onFinish (node:internal/streams/writable:667:37)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:526:9)
at processTimers (node:internal/timers:500:7) {
code: 'ERR_MULTIPLE_CALLBACK'
So, according to #MattRaible and #GaelMariou, when having the ERROR! Callback called multiple times when generating JHipter applications or entities, you should verify the Node JS version. That version is provided in pom.xml or build.gradle, however, I never found a reference of node version in pom.xml (I use maven).
It is not clear where to get the exact version, nevertheless there is this article that states the same problem using node.js version bigger than 14: https://github.com/jhipster/generator-jhipster/issues/16744.
Meaning you should keep your node.js in version 14 until they solve that issue. I changed to v14.18.1, and now it is working sharp.

Module build failed: TypeError: loader.charAt is not a function

I'm trying to run the npm run dev command, but I'm getting this message:
ERROR Failed to compile with 2 errors 21:31:43
Module build failed: TypeError: loader.charAt is not a function
at ensureBang (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:180:16)
at getLoaderString (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:145:18)
at getRequireString (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:80:7)
at getRequire (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:71:7)
at D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:205:11
at Array.forEach (<anonymous>)
at Object.module.exports (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:198:18)
Module build failed: TypeError: loader.charAt is not a function
at ensureBang (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:180:16)
at getLoaderString (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:145:18)
at getRequireString (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:80:7)
at getRequire (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:71:7)
at D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:205:11
at Array.forEach (<anonymous>)
at Object.module.exports (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:198:18)
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
This problem appeared when I tried to reinstall all the modules. Anything, my project is on Github. Follow the repository link https://github.com/iagofrota/todo-list.

node require bluebird failing

I am running a node.js app and for some reason the node app is failing when requiring the bluebird module require('bluebird').
node version: 0.10.40
bluebird version: 3.3.4
This is really strange and the only thing I have to go off of is the stack trace here:
TypeError: Cannot call method 'split' of undefined
at Object.setBounds (app/node_modules/bluebird/js/release/debuggability.js:614:48)
at module.exports (app/node_modules/bluebird/js/release/promise.js:762:11)
at Object.<anonymous> (app/node_modules/bluebird/js/release/bluebird.js:9:36)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
var firstStackLines = firstLineError.stack.split("\n");
Again, the app runs just fine. When I add this one line require('bluebird') it crashes and I get this stack trace. Any ideas on what this error is coming from?
[Edit]
at line node_modules/bluebird/js/release/debuggability.js:614:48
> console.log(firstLineError);
[Error]
> console.log(firstLineError.message);
> console.log(firstLineError.stack);
undefined
> console.log(firstLineError.toString());
Error: Error
> console.log(firstLineError instanceof Error);
True
It is an Error object that is essentially empty
temporary solution
When I change the line node_modules/bluebird/js/release/debuggability.js:614 to
var firstStackLines = (firstLineError.stack) ? firstLineError.stack.split("\n") : "";
and line 615 to
var lastStackLines = (lastLineError.stack) ? lastLineError.stack.split("\n") : "";
it works just fine. Not sure if this has lasting effects though
I had the similar failures, more specifically:
.../node_modules/bluebird/js/release/debuggability.js:673
var firstStackLines = firstLineError.stack.split("\n");
when using node 6.2.2 with bluebird^3.4.1.
Upgrading to bluebird^3.4.6 with node v6.2.2 helped fix the error.
Manually remove your node_modules folder and re-run npm install as it sounds like NPM didn't correctly install something.
You're using the latest version of Bluebird with an outdated version of node.
The problem for me was that I was using another module pretty-error that was modifying the console object and therefore, bluebirds error handling was receiving a mutated console object that was not the shape that bluebird expected.

Unable to get strong-remote example to work

I'm trying the example: https://github.com/strongloop/strong-remoting/blob/master/example/simple.js
When I invoke the curl, I get: curl: (52) Empty reply from server
and the node program exits with:
sm#valley:~/Documents/Projects/test/loopback.io/remoting$ node simple.js
/home/sm/Documents/Projects/test/loopback.io/node_modules/strong-remoting/node_modules/express/lib/router/index.js:603
return fn.apply(this, arguments);
^
TypeError: Cannot call method 'apply' of undefined
at Object. (/home/sm/Documents/Projects/test/loopback.io/node_modules/strong-remoting/node_modules/express/lib/router/index.js:603:15)
at Object.immediate._onImmediate (timers.js:348:16)
at processImmediate [as _immediateCallback] (timers.js:330:15)
Any idea what I'm missing ?
You may want to also look at https://github.com/strongloop/loopback-example-remote. It's an example of the LB remote connector, which uses strong-remoting. Not sure if it fits your use case, but AFAIK it works.

Resources