问题描述
我开始在运行 nativescript 时遇到问题,错误消息确实令人困惑,因为它是退出代码 0.
I've started having problems getting nativescript to run, and the error message is truly confusing, since it is exit code 0.
tns run android
Searching for devices...
NativeScript Environment: tns run <platform> --env not provided.
NativeScript Environment: Environment vars not changed
Preparing project...
File change detected. Starting incremental webpack compilation...
webpack is watching the files…
Executing webpack failed with exit code 0.
我已经尝试了常见的可疑补救措施列表:卸载/重新安装 nativescript、平台等.tns doctor
给了我一个完整的绿色复选标记清单.这只是今天开始发生.在过去一年多的开发中,我一直在使用它而没有出现此问题.
接下来我应该尝试什么?
I've tried the usual suspect list of remedies: uninstall/reinstall nativescript, platforms, etc. tns doctor
gives me a full green-checkmark bill of clean health.This just started happening today. I've been using it without this problem for over a year of development prior.
What should I try next?
推荐答案
好吧,这对我来说现在又起作用了.这是我发现的:
Well, this is working again now for me.Here's what I found:
- 我发现我能够毫无问题地构建一个不同的项目,但不是我的主要工作.
- 在其他一些乱七八糟的事情之后,我终于收到了一条错误消息,抱怨我的 webpack.config.js 与我的一个插件的不同.它建议我运行 ./node_modules/.bin/update-ns-webpack --configs 以恢复到已批准的配置.
- 我这样做了,并且奏效了.然而,我前段时间故意修改了我的 webpack 配置,以允许传输一些特定于应用程序的文件,如下所示.
- 我将自定义的globs"行放回去,它仍然有效,尽管这与整个事件开始时的情况相同.
- 去看看.
- I found I was able to build a different project without issue, but not my main work.
- After other messing about, I finally was given an error message that complained that my webpack.config.js was different than that of one of my plugins. It suggested I run ./node_modules/.bin/update-ns-webpack --configs to revert to an approved configuration.
- I did that, and it worked. However, I had deliberately modified my webpack config some time ago to allow some app-specific files to transfer, as shown below.
- I put my custom 'globs' lines back in and it still works, although this is the same as where it was when the whole affair started.
- go figure.
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
{ from: { glob: "fonts/**" } },
{ from: { glob: "**/*.jpg" } },
{ from: { glob: "**/*.png" } },
{ from: { glob: "**/*.json" } },
{ from: { glob: "**/*.map" } }
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
(*.json 和 *.map 条目是我添加的).正如评论所暗示的那样,这似乎是为此目的进行的配置修改的鼓励形式.
(the *.json and *.map entries are my additions). As the comment implies, this appears to be an encouraged form of config modification for this purpose.
这篇关于nativescript 无法运行,退出代码为 0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!