Adonis 5 node deprecated warning when using migration - node.js

This has recently started poping up in commandline....anyone know whats going on, Im unsure why the new package in node_modules is not compatable with node v14.16. I tried using older version of node (docs state min version for adonis 5 is version 12), although this produces a syntax error.
This container.with() is deprecated warning shows whenever using the node ace commands. How can I fix these?
Node version 14.16.0:
node --trace-warnings ace migration:rollback
(node:24088) container.with() is deprecated. Use container.withBindings() instead: DeprecationWarning
at Ioc.with (C:\project\node_modules\#adonisjs\fold\build\src\Ioc\index.js:421:17)
at DatabaseServiceProvider.registerHealthChecker (C:\project\node_modules\#adonisjs\lucid\build\providers\DatabaseProvider.js:93:32)
at DatabaseServiceProvider.boot (C:\project\node_modules\#adonisjs\lucid\build\providers\DatabaseProvider.js:140:14)
at Registrar.boot (C:\project\node_modules\#adonisjs\fold\build\src\Registrar\index.js:116:32)
at C:\project\node_modules\#adonisjs\application\build\src\Application.js:543:13
at Profiler.profileAsync (C:\project\node_modules\#adonisjs\application\node_modules\#adonisjs\profiler\build\src\Profiler\AbstractProfiler.js:20:32)
at Application.bootProviders (C:\project\node_modules\#adonisjs\application\build\src\Application.js:541:9)
at App.wire (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:192:9)
at App.onFind (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:145:13)
at Hooks.execute (C:\project\node_modules\#adonisjs\ace\build\src\Hooks\index.js:44:13)
(node:24088) container.with() is deprecated. Use container.withBindings() instead: DeprecationWarning
at Ioc.with (C:\project\node_modules\#adonisjs\fold\build\src\Ioc\index.js:421:17)
at DatabaseServiceProvider.defineValidationRules (C:\project\node_modules\#adonisjs\lucid\build\providers\DatabaseProvider.js:109:32)
at DatabaseServiceProvider.boot (C:\project\node_modules\#adonisjs\lucid\build\providers\DatabaseProvider.js:141:14)
at Registrar.boot (C:\project\node_modules\#adonisjs\fold\build\src\Registrar\index.js:116:32)
at C:\project\node_modules\#adonisjs\application\build\src\Application.js:543:13
at Profiler.profileAsync (C:\project\node_modules\#adonisjs\application\node_modules\#adonisjs\profiler\build\src\Profiler\AbstractProfiler.js:20:32)
at Application.bootProviders (C:\project\node_modules\#adonisjs\application\build\src\Application.js:541:9)
at App.wire (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:192:9)
at App.onFind (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:145:13)
at Hooks.execute (C:\project\node_modules\#adonisjs\ace\build\src\Hooks\index.js:44:13)
(node:24088) container.with() is deprecated. Use container.withBindings() instead: DeprecationWarning
at Ioc.with (C:\project\node_modules\#adonisjs\fold\build\src\Ioc\index.js:421:17)
at AuthProvider.boot (C:\project\node_modules\#adonisjs\auth\build\providers\AuthProvider.js:32:40)
at Registrar.boot (C:\project\node_modules\#adonisjs\fold\build\src\Registrar\index.js:116:32)
at C:\project\node_modules\#adonisjs\application\build\src\Application.js:543:13
at Profiler.profileAsync (C:\project\node_modules\#adonisjs\application\node_modules\#adonisjs\profiler\build\src\Profiler\AbstractProfiler.js:20:32)
at Application.bootProviders (C:\project\node_modules\#adonisjs\application\build\src\Application.js:541:9)
at App.wire (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:192:9)
at App.onFind (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:145:13)
at Hooks.execute (C:\project\node_modules\#adonisjs\ace\build\src\Hooks\index.js:44:13)
at Kernel.find (C:\project\node_modules\#adonisjs\ace\build\src\Kernel\index.js:371:13)
(node:24088) container.with() is deprecated. Use container.withBindings() instead: DeprecationWarning
at Ioc.with (C:\project\node_modules\#adonisjs\fold\build\src\Ioc\index.js:421:17)
at AuthProvider.boot (C:\project\node_modules\#adonisjs\auth\build\providers\AuthProvider.js:37:40)
at Registrar.boot (C:\project\node_modules\#adonisjs\fold\build\src\Registrar\index.js:116:32)
at C:\project\node_modules\#adonisjs\application\build\src\Application.js:543:13
at Profiler.profileAsync (C:\project\node_modules\#adonisjs\application\node_modules\#adonisjs\profiler\build\src\Profiler\AbstractProfiler.js:20:32)
at Application.bootProviders (C:\project\node_modules\#adonisjs\application\build\src\Application.js:541:9)
at App.wire (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:192:9)
at App.onFind (C:\project\node_modules\#adonisjs\core\build\src\Ignitor\Ace\App\index.js:145:13)
at Hooks.execute (C:\project\node_modules\#adonisjs\ace\build\src\Hooks\index.js:44:13)
at Kernel.find (C:\project\node_modules\#adonisjs\ace\build\src\Kernel\index.js:371:13)
Node version 12.5.0:
node ace migration:rollback
C:\project\node_modules\#poppinss\utils\build\src\Helpers\string.js:241
return `${values[0]}${options?.pairSeparator || ' and '}${values[1]}`;
^
SyntaxError: Unexpected token .
at Module._compile (internal/modules/cjs/loader.js:720:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at Object.<anonymous> (C:\project\node_modules\#poppinss\utils\build\src\Helpers\index.js:56:31)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)

Looks like after updating to latest 'release' version of adonis 5 this issue has been resolved. Stupid preview issues

#poppinss\utils\build\src\Helpers\string.js:241 uses optional chaining which is only supported from Node.js 14
Using Node.js v14.15 will fix the problem.
I personally had this problem with Node.js 12 and Node.js 14.16. I switched to Node.js v14.15.1 and it worked instantly.

It's the Lucid package. Running npm i #adonisjs/lucid#latest solves the issue.

Related

Testcafe / Jenkins job failing TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function. Received undefined

I have a jenkins job that has worked consistently for the past 2 years running various front end tests, but recently I've gotten a stack trace from the job in jenkins that is continuously failing where I'm unsure what to do to fix it. The stack trace is listed below from the job:
TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function. Received undefined
at promisify (internal/util.js:279:11)
at Object.<anonymous> (/home/ec2-user/workspace/Sandbox_Verify/node_modules/testcafe-safe-storage/lib/file.js:18:33)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/ec2-user/workspace/Sandbox_Verify/node_modules/testcafe-safe-storage/lib/index.js:30:19)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/ec2-user/workspace/Sandbox_Verify/node_modules/testcafe/lib/dashboard/config-storage.js:3:33) {
code: 'ERR_INVALID_ARG_TYPE'
}
I am facing the same issue. Looks like there was a latest version of testCafe 1.19.0 version released yesterday after which the issue started. If you change your testcafe version to "testcafe": "1.18.6" or remove the ^ it should work. Or may be need to upgrade the nodejs version being used. Got the below warning
npm WARN notsup Unsupported engine for testcafe#1.19.0: wanted: {"node":">=14.0.0"} (current: {"node":"10.24.1","npm":"6.14.12"})
This is due to the testcafe global version. I think
you can check the global version by testcafe --version
and confirm your project installed version -> you can check your package.json file
If both are mismatch means, this issue could occur. So you should set BOTH version to be same
Ex: npm i -g testcafe#1.18.6
In package.json --> testcafe": "^1.18.6
in my case, its works perfectly. and also I have used firefox:headless
The cause of the issue is that you are using an outdated Node.js version.
The crypto.randomUUID function doesn't exist in Node.js 10.24.1.
Please update it to 14.x and all will work correctly.

Cannot import cloudinary in nodeJS with "navigator undefined" error

I recently installed cloudinary via npm and cannot import it in my nodeJS backend due to the following error.
(base) feiwu#Feis-MacBook-Pro backend % node server.js
/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:1168
var useAgent = navigator && navigator.userAgent || '';
^
ReferenceError: navigator is not defined
at Module../src/namespace/cloudinary-core.js (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:1168:16)
at __webpack_require__ (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:37:30)
at /Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:101:18
at /Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:104:10
at webpackUniversalModuleDefinition (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:10:20)
at Object.<anonymous> (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary-core/cloudinary-core.js:17:3)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/Users/feiwu/projects/inventaire/backend/node_modules/cloudinary/lib/utils/index.js:48:57)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
I have found nothing so far about this error and would like to know if someone know about this issue ?
This error is from cloudinary's end. Fix this error with npm i cloudinary-core.
Started happening to me around 15 hours ago as well.
Cloudinary had just released a new version to its JS SDK (version 2.12.2) that fixes this issue.
installing cloudinary-core helped me get rid of this error
npm i cloudinary-core
This issue was introduced recently in Cloudinary version 1.28.0.
https://www.npmjs.com/package/cloudinary/v/1.28.0
The issue reported on github here : https://github.com/cloudinary/cloudinary_npm/issues/524
I was able to fix this issue by pointing cloudinary to 1.27.1
"cloudinary": "1.27.1"
Cloudinary guys have fixed this issue here : https://github.com/cloudinary/cloudinary_js/pull/281.

pptxgenjs 3.0 node js ReferenceError: JSZip is not defined

On Friday January 3rd, 2019, pptxgenjs library has been upgraded from version 2.6.0 to 3.0.0. This being said when I upgraded the package and attempted to start my server it gave me the following error
ReferenceError: JSZip is not defined
at Object.<anonymous> (/Users/a.farghaly/Desktop/up-api/node_modules/pptxgenjs/dist/pptxgen.min.js:2:190018)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Module.require (internal/modules/cjs/loader.js:830:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.<anonymous> (/Users/a.farghaly/Desktop/upsiide-api/utility/powerpoint/ppt.js:1:19)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
[nodemon] app crashed - waiting for file changes before starting...
This being said JSZip works fine with the previouse version (2.6.0)
I would be thankful if anyone can help me with this issue
A screenshot from npmjs.com main page trying pptxgenjs v3.0.0
It's a bug: https://github.com/gitbrent/PptxGenJS/issues/638
Using https://github.com/gitbrent/PptxGenJS.git#2cee3f0c412106aefb1f87fc16bfef78ae5521a7 and it works with NodeJS.
It’s a bug where Node was referencing dist/pptxgenjs.min.js intead of dist/pptxgenjs.min.js. In pptxgenjs.min.js jszip library is not defined

Nodejs "SyntaxError: Unexpected token ."

I'm trying to run a Bitcoin insight explorer (https://www.dgbwiki.com/index.php?title=Running_your_own_Insight_explorer). Using node v0.10.48 but I get this error (couldn't find the same problem over the internet):
digibyte#derecha-virtual-machine:~/insight$ /home/digibyte/.nvm/v0.10.48/bin/node ~/insight/node_modules/insight-bitcore-api/util/sync.js -D -v --rpc
/home/digibyte/insight/node_modules/insight-bitcore-api/node_modules/async/dist/async.js:52
function apply(fn, ...args) {
^
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/digibyte/insight/node_modules/insight-bitcore-api/lib/HistoricSync.js:5:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
The offending line 52 is in this function:
function apply(fn, ...args) { // <- line 52
return (...callArgs) => fn(...args,...callArgs);
}
It looks ok to me I don't know why node gives an error.
Node.js 0.10.48 doesn't support the spread operator. The first Node.js version to support the spread operator was 5, but it's quite outdated and isn't maintained anymore. If you're already upgrading, I'd upgrade to one of the newer version still supported under LTS.
According to https://node.green/#ES2015-syntax-rest-parameters, node v0.10.48 does not support rest parameters (...args).
You should use a newer version of node (at least v6.4.0 as default support, or at least v4.9.1 with --harmony flag (node --harmony))
Apply takes an array as the second argument. Here, the spread operator (...) is laying out the elements, and thus you don't pass an array into the function, but basically comma separated arguments.
Try using .call instead of .apply, or pass args instead of ...args.

internal modules cjs is not working after yarn upgraded to 1.13.0

I have a react app which is based on react boilerplate. I am running the
following command:
cross-env NODE_ENV=development node --experimental-modules ./server/index.mjs
After upgrading yarn to 1.13.0, I am getting the following error:
(node:11137) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/cjs/loader.js:677
module.reflect.onReady((reflect) => {
^
TypeError: Cannot read property 'onReady' of undefined
at Module.load (internal/modules/cjs/loader.js:677:22)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Module.require (internal/modules/cjs/loader.js:705:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/Users/mdjahidulislam/workspace/ifs/frontend/node_modules/psl/index.js:14:19)
at Module._compile (internal/modules/cjs/loader.js:799:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Seems like module.reflect is undefined. In which scenario it can be undefined and how I can solve the problem.
Thanks in advance for any help and suggestions.
Finally solved it. It was all about nodejs version. I had nodejs version 11.* and then I downgraded it on 10.* and it solved the issue.

Resources