我在做什么以及出了什么问题
我正在开发一个新项目 ( 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
)。 - 正在重新安装 Node 包。
我的问题
最好的解决方案是什么?没有带有“WARN”的控制台垃圾邮件并有一个工作的应用程序。
或者没有解决办法?根据this post ,目前无法避免控制台中出现这些可怕的 WARN 错误。
我的代码:
(在 GitHub 上开源)
最佳答案
这是一个已经修复并等待发布的新错误。
可在此处找到更多信息:Latest Nuxt v2.15.7 install with babel "loose" option warnings
关于javascript - Nuxt 抛出 'The "path"argument must be of type string' or console spam,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68671411/