【发布时间】:2021-10-10 17:56:44
【问题描述】:
我在做什么和出了什么问题
我正在开发一个新项目 (GitHub repo),当我尝试运行本地开发服务器时出现此错误:
> jakub-suchenek@1.1.0 dev
> nuxt
╭───────────────────────────────────────╮
│ │
│ Nuxt @ v2.15.7 │
│ │
│ ▸ Environment: development │
│ ▸ Rendering: server-side │
│ ▸ Target: server │
│ │
│ Listening: http://localhost:3000/ │
│ │
╰───────────────────────────────────────╯
i Preparing project for development 19:29:23
i Initial build may take a while 19:29:23
i Discovered Components: .nuxt/components/readme.md 19:29:23
√ Builder initialized 19:29:23
ERROR The "path" argument must be of type string. Received undefined 19:29:23
at new NodeError (node:internal/errors:371:5)
at validateString (node:internal/validators:119:11)
at Object.extname (node:path:837:5)
at node_modules\@nuxt\builder\dist\builder.js:413:98
at Array.map (<anonymous>)
at Builder.normalizePlugins (node_modules\@nuxt\builder\dist\builder.js:409:28)
at async Builder.generateRoutesAndFiles (node_modules\@nuxt\builder\dist\builder.js:371:31)
at async Builder.build (node_modules\@nuxt\builder\dist\builder.js:319:5)
at async Object._buildDev (node_modules\@nuxt\cli\dist\cli-dev.js:107:5)
at async Object.startDev (node_modules\@nuxt\cli\dist\cli-dev.js:65:7)
at async Object.run (node_modules\@nuxt\cli\dist\cli-dev.js:52:5)
at async NuxtCommand.run (node_modules\@nuxt\cli\dist\cli-index.js:413:7)
但这只有在我的 nuxt.config.js 文件中有这个时才会发生:
plugins: [ "@babel/plugin-proposal-private-property-in-object", { "loose": true }],
没有这个插件配置,我在控制台中有很多垃圾邮件。
plugins: [],
几百次:
WARN Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-methods.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
["@babel/plugin-proposal-private-property-in-object", { "loose": true }]
to the "plugins" section of your Babel config.
我尝试过的
- 更改 Nuxt.js 版本(
2.15、2.14、2.13)。 - 重新安装节点包。
我的问题
对此最好的解决方案是什么?没有带有“WARN”的控制台垃圾邮件并且有一个正常工作的应用程序。
还是没有解决办法?根据this post 的说法,目前无法在控制台中不出现这些可怕的 WARN 错误。
我的代码:
(在 GitHub 上开源)
【问题讨论】:
标签: javascript node.js babeljs nuxt.js