Nativescript 错误:执行 webpack 失败,退出代码 1

2024-03-21

我已经在新的 iMac(运行 Big Sur)上按照说明仔细安装了 Nativescript(来自https://docs.nativescript.org/environment-setup.html#macos-ios https://docs.nativescript.org/environment-setup.html#macos-ios).

昨天安装后工作正常,但今天我无法在 ios 模拟器(或 Android 虚拟设备)中运行应用程序。

The 国民警卫队医生终端中的命令最初给了我这个:

No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 12.5.1 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.0.2 version and is up to date.

但是,当我创建一个新应用程序时(ns 创建) 然后尝试运行 (ns 运行 ios),我收到此错误:执行 webpack 失败,退出代码为 1。

错误消息以此开头:类型错误:无法读取未定义的属性“已解析”。

当我尝试在 Android 上运行它时,也会发生同样的事情。

尝试在 ios 和 Android 上运行后,国民警卫队医生添加这些行:

✔ Component @nativescript/core has 8.0.8 version and is up to date.
✔ Component @nativescript/ios has 8.0.0 version and is up to date.
✔ Component @nativescript/android has 8.0.0 version and is up to date.

所以看起来平台的添加是正确的。

任何帮助将不胜感激!

完整的错误消息是:

Searching for devices...
Preparing project...
webpack is watching the files...
/Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:817
    if (entry.resolved !== undefined) return entry.resolved;
              ^

TypeError: Cannot read property 'resolved' of undefined
    at getResolvedTimestamp (/Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:817:12)
    at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:1167:21
    at /Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:352:5
    at Hook.eval [as callAsync] (eval at create (/Users/student/Desktop/testApp/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/student/Desktop/testApp/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at AsyncQueue._handleResult (/Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:322:21)
    at /Users/student/Desktop/testApp/node_modules/webpack/lib/util/AsyncQueue.js:305:11
    at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:3098:21
    at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:3010:22
    at /Users/student/Desktop/testApp/node_modules/neo-async/async.js:2830:7
    at done (/Users/student/Desktop/testApp/node_modules/neo-async/async.js:2925:13)
    at /Users/student/Desktop/testApp/node_modules/webpack/lib/FileSystemInfo.js:2994:23
    at Array.<anonymous> (/Users/student/Desktop/testApp/node_modules/webpack/lib/util/fs.js:311:21)
    at runCallbacks (/Users/student/Desktop/testApp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:27:15)
    at /Users/student/Desktop/testApp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:200:4
    at callback (/Users/student/Desktop/testApp/node_modules/graceful-fs/polyfills.js:299:20)
Executing webpack failed with exit code 1.

感谢您报告这一点,我们已经确认最新的 webpack 版本中发生了重大更改:https://github.com/webpack/webpack/releases/tag/v5.51.1 https://github.com/webpack/webpack/releases/tag/v5.51.1

您可以切换 package.json 以使用rc立即解决此问题如下:

"devDependencies": {
  ...
  "@nativescript/webpack": "rc"
},

Then ns clean现在您应该可以运行您的应用程序了。

我们还发布了另一篇beta标记将 webpack 固定到 5.50.0 这样做ns clean无需在您自己的 package.json 中进行任何其他依赖项更改,现在也应该可以工作。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Nativescript 错误:执行 webpack 失败,退出代码 1 的相关文章

随机推荐