使用迁移时 Adonis 5 节点弃用警告
Adonis 5 node deprecated warning when using migration
这最近开始在命令行中弹出....任何人都知道发生了什么,我不确定为什么 node_modules 中的新包与节点 v14.16 不兼容。我尝试使用旧版本的节点(adonis 5 的文档状态最小版本是版本 12),尽管这会产生语法错误。
此 container.with() is deprecated
警告在使用节点 ace 命令时显示。我该如何解决这些问题?
节点版本 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)
节点版本 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)
@poppinss\utils\build\src\Helpers\string.js:241
使用 optional chaining 仅支持 Node.js 14
使用 Node.js v14.15 将解决该问题。
我个人在使用 Node.js 12 和 Node.js 14.16 时遇到了这个问题。我切换到 Node.js v14.15.1 并立即运行。
看起来在更新到最新的 'release' 版本的 adonis 5 之后,这个问题已经解决了。愚蠢的预览问题
这是 Lucid 软件包。 运行 npm i @adonisjs/lucid@latest 解决了这个问题。
这最近开始在命令行中弹出....任何人都知道发生了什么,我不确定为什么 node_modules 中的新包与节点 v14.16 不兼容。我尝试使用旧版本的节点(adonis 5 的文档状态最小版本是版本 12),尽管这会产生语法错误。
此 container.with() is deprecated
警告在使用节点 ace 命令时显示。我该如何解决这些问题?
节点版本 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)
节点版本 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)
@poppinss\utils\build\src\Helpers\string.js:241
使用 optional chaining 仅支持 Node.js 14
使用 Node.js v14.15 将解决该问题。 我个人在使用 Node.js 12 和 Node.js 14.16 时遇到了这个问题。我切换到 Node.js v14.15.1 并立即运行。
看起来在更新到最新的 'release' 版本的 adonis 5 之后,这个问题已经解决了。愚蠢的预览问题
这是 Lucid 软件包。 运行 npm i @adonisjs/lucid@latest 解决了这个问题。