我的同事使用 NativeScript + Angular 创建了一个项目。
她已将项目推送到 git-repo 中,然后我将其克隆到我的机器上。
我在本指南下安装了所有内容,但是当我运行
tns build android
时,它会抛出此错误:
ERROR in tns_modules/inspector_modules
Module not found: Error: Can't resolve '@nativescript/core/inspector_modules' in 'C:\Repository\Solutions\RaptorApp\RaptorApp'
resolve '@nativescript/core/inspector_modules' in 'C:\Repository\Solutions\RaptorApp\RaptorApp'
Parsed request is a module
using description file: C:\Repository\Solutions\RaptorApp\RaptorApp\package.json (relative path: .)
resolve as module
looking for modules in C:\Repository\Solutions\RaptorApp\RaptorApp\node_modules
existing directory C:\Repository\Solutions\RaptorApp\RaptorApp\node_modules\@nativescript\core
using description file: C:\Repository\Solutions\RaptorApp\RaptorApp\node_modules\@nativescript\core\package.json (relative path: .)
using description file: C:\Repository\Solutions\RaptorApp\RaptorApp\node_modules\@nativescript\core\package.json (relative path: ./inspector_modules)
no extension
C:\Repository\Solutions\RaptorApp\RaptorApp\node_modules\@nativescript\core\inspector_modules doesn't exist
.android.ts
它列出了许多具有相同路径的其他文件 相同但扩展名不同。
命令
tns doctor
表示一切都好。
我该如何解决这个问题?
这看起来与此处提到的问题相同。本质上是 @nativescript/webpack 最近的更新导致了这一点。如果您有允许补丁更新的依赖项(例如
"@nativescript/webpack": "~5.0.0"
),您可能会在 ns clean
之后获得此更新。
现已在5.0.20版本修复,请尝试更新版本,或锁定版本至5.0.18。