【问题标题】:Nativescript-vue doesn't work without --bundle option没有 --bundle 选项 Nativescript-vue 不起作用
【发布时间】:2019-08-09 00:14:44
【问题描述】:

请告诉我我可以提供哪些信息来更好地帮助解决此问题。到目前为止,我一直在阅读 webpack,比较我的 webpack.config.js 文件,并随机搜索到 Google void。

今天早上早些时候,我正在按预期运行我的 NativeScript-vue 项目。做了一些更改,保存,测试,清洗,冲洗重复。然后我尝试构建并收到以下错误消息:

Unable to apply changes on device: emulator-####. Error is: Nativescript-vue doesn't work without --bundle option. Please specify --bundle option to the command and execute it again..

我一直在编辑一个 .vue 文件——我没有修改任何其他文件,尤其是配置文件。

是什么导致了这个问题?
我该如何解决这个问题?
有没有比粘贴错误消息更智能的搜索?

更新:

根据@Estradiaz 的要求

我一直在尝试通过以下方式运行应用程序:
tns run android --bundle
(也尝试了ios 并得到了相同的结果)

我已经使用npm installtns install 构建了这个项目

我的 package.json 中唯一的脚本是:

"clean": "rm -rf node_modules/* && rm -rf hooks/* && rm -rf platforms/* && rm webpack.config.js && rm package-lock.json"

(只是在添加新资产时/在添加新资产时销毁所有内容)

运行 TNS 版本 #5.2.4

终端的输出是:

Webpack compilation complete. Watching for file changes.
Webpack build done!
Unable to apply changes on device: emulator-5554. Error is: Nativescript-vue doesn't work without --bundle option. Please specify --bundle option to the command and execute it again..

更新更新:

Estradiaz 掉落了一些伟大的知识;但是,当我的 nativescript-vue 包从 2.0.2 更新到 2.1.0 时,我发现我的错误来自 2.1.0

回滚到 2.0.2 解决了我的具体问题。其他开发者已经开始报告类似问题:https://github.com/nativescript-vue/nativescript-vue/issues/454https://github.com/nativescript-vue/nativescript-vue/pull/361#issuecomment-474079850

【问题讨论】:

  • 如何启动您的应用程序? Tns 还是 npm?你能发布脚本吗?
  • 嗨 @Estradiaz 谢谢你回复我 :) 我已经更新了更多细节的问题——我希望这些是你想要的。
  • 看起来不错 - 请问,以前从未这样做过,我现在懒得测试 - 只是一个想法 - 你只使用了原生组件?
  • 据我所知,是的。 nativescript-{orientation、theme-core、ui-listview、ui-sidedrawer、vue}、tns-core-modules 和 vuex。这些都不是项目的新增内容;过去几天我一直在研究 UI 布局(我的假设是如果我破坏 UI,那么屏幕将不会显示,而不是构建逻辑会失败)
  • 是的 - 但我认为当 tns 无法解释代码时会发生此错误 - imo 忘记 --bundle 或捆绑错误 - 我现在在手机中将构建一个稍后测试我是否可以重新创建

标签: vue.js webpack nativescript nativescript-vue nativescript-cli


【解决方案1】:

经过一些故障排除(以及技术主管的帮助),我们今天找到了一个新的nativescript-vuepackage was released(从 2.0.2 升级到 2.1.0)。

其中,“功能”#361 是:“未提供 --bundle 选项时显示错误”

我不知道这在我的项目范围内实际上意味着什么,也不知道我是如何调用构建的,也不知道它为什么会中断……但回滚到 2.0.2 解决了我的问题。

【讨论】:

    【解决方案2】:

    搜索错字

    the bugging history of code ;)

    如果不更改开发依赖项,"--bundle" 错误的主要原因是使用了非本机元素 - 例如标签改为Label

    以下:

    $ npm install -g @vue/cli @vue/cli-init
    $ vue init nativescript-vue/vue-cli-template <project-name>
    $ cd <project-name>
    $
    $ npm install
    $ # or
    $ yarn install
    $
    $ tns run android --bundle
    $ # or
    $ tns run ios --bundle
    

    来自:Quick Start

    然后 - 在运行时 - 更改 ./app/components/App.vue:

    <template>
        <Page>
            <ActionBar title="Welcome to NativeScript-Vue!"/>
            <GridLayout columns="*" rows="*">
                <Label class="message" :text="msg" col="0" row="0"/>
    
            </GridLayout>
        </Page>
    </template>
    

    到(html:div):

    <template>
        <Page>
            <ActionBar title="Welcome to NativeScript-Vue!"/>
            <GridLayout columns="*" rows="*">
    
                <div id="hello"></div>
            </GridLayout>
        </Page>
    </template>
    

    或至(错字:标签而不是Label):

    <template>
        <Page>
            <ActionBar title="Welcome to NativeScript-Vue!"/>
            <GridLayout columns="*" rows="*">
                <Lable class="message" :text="msg" col="0" row="0"/>
    
            </GridLayout>
        </Page>
    </template>
    

    会收到以下错误:

    Webpack 编译完成。监视文件更改。 Webpack 构建 完成!

    无法在设备上应用更改:emulator-5554。错误是: 如果没有 --bundle 选项,Nativescript-vue 将无法工作。请明确说明 --bundle 选项到命令并再次执行..

    【讨论】:

    • 非常感谢!奇怪的是,我们发现这是从今天开始最新版本的 nativescript-vue @2.1.0 的问题——回滚到 2.0.2 解决了这个问题。看起来很多其他开发人员也开始遇到这种情况。 github.com/nativescript-vue/nativescript-vue/issues/454
    • 我一直在编辑一个 .vue 文件——我没有修改任何其他文件,尤其是配置文件。有点误导^^你欢迎:)
    • 是的。对于那个很抱歉。我没有想到我的 nativescript-vue 包设置为“最新”。所以当我在一个新版本上把所有东西都吹走时,我问,因为我没有更改任何版本号,所以一切都会保持原样。抱歉,这是一个不可能的问题,除非我将整个 repo 倾倒到票中。
    【解决方案3】:

    今天nativescript-vue (2.1.0) 发布了一个损坏的版本,这导致了您遇到的问题。我们已经发布了带有修复程序的2.2.0,因此请确保您运行的是最新版本。

    【讨论】:

    • 我在 2.2.2 中遇到了同样的问题,我回滚到 2.0.2(如 @doug 建议的那样)并且问题消失了
    猜你喜欢
    • 1970-01-01
    • 2019-12-25
    • 1970-01-01
    • 1970-01-01
    • 2020-06-03
    • 2020-08-07
    • 2019-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多