4

我正在使用 Laravel 和 Jetsream 以及 Vuejs & Inertia 堆栈开发一个应用程序,并且在运行后在我的应用程序中得到一个空白页面npm audit fix

npm audit fix在收到一条消息说存在 3 个高严重性漏洞后,我运行了 npm 命令。这是输出:

npm WARN deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN @inertiajs/inertia-vue@0.2.4 requires a peer of @inertiajs/inertia@^0.2.0 || ^0.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ axios@0.21.1
+ @inertiajs/inertia@0.8.2
added 4 packages from 5 contributors and updated 2 packages in 4.307s

55 packages are looking for funding
  run `npm fund` for details

fixed 2 of 3 vulnerabilities in 1150 scanned packages
  1 vulnerability required manual review and could not be updated

自从运行该命令后,网站上的每个页面都是空白的,并且在控制台中显示以下错误:

app.js:121 Uncaught (in promise) TypeError: n.swapComponent is not a function
    at app.js:121
(anonymous) @ app.js:121
Promise.then (async)
setPage @ app.js:121
handleInitialPageVisit @ app.js:121
init @ app.js:121
created @ app.js:108
invokeWithErrorHandling @ app.js:104023
callHook @ app.js:106380
Vue._init @ app.js:107162
VueComponent @ app.js:107307
createComponentInstanceForVnode @ app.js:105450
init @ app.js:105281
createComponent @ app.js:108133
createElm @ app.js:108080
patch @ app.js:108669
Vue._update @ app.js:106106
updateComponent @ app.js:106227
get @ app.js:106638
Watcher @ app.js:106627
mountComponent @ app.js:106234
./node_modules/vue/dist/vue.common.dev.js.Vue.$mount @ app.js:111204
./node_modules/vue/dist/vue.common.dev.js.Vue.$mount @ app.js:114104
./resources/js/app.js @ app.js:120619
__webpack_require__ @ app.js:20
0 @ app.js:120679
__webpack_require__ @ app.js:20
(anonymous) @ app.js:84
(anonymous) @ app.js:87

我是 laravel/这个堆栈的新手,任何帮助追踪这个问题的根源将不胜感激。

4

3 回答 3

5

我升级时遇到同样的问题

从:


"@inertiajs/inertia": "^0.1.9",

"@inertiajs/inertia": "^0.8.2",

由于它是由 GitHub 安全审计建议的,所以现在我只是恢复到^0.1.9

于 2021-01-08T04:14:58.110 回答
3

尝试将软件包更新@inertiajs/inertia-vue到最新版本“^0.5.4”。

在 package.json 中设置 "@inertiajs/inertia-vue": "^0.5.4" 并运行npm install.

从我这里工作!

于 2021-01-06T20:59:53.867 回答
1

在 npm update 之后我也遇到了同样的问题,为了解决这个问题,我已经降级了惯性包。在 package.json "@inertiajs/inertia": "^0.1.7" 然后 npm 安装。

于 2021-01-08T10:06:27.747 回答