问题
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.
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?
回答1:
Well, this is working again now for me. Here's what I found:
- 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)}/**`] }),
(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.
来源:https://stackoverflow.com/questions/60348270/nativescript-fails-to-run-with-an-exit-code-of-0