vue-cli-service 在 heroku 中构建失败
vue-cli-service build failing in heroku
我有一个非常基本的应用程序,默认 vue-cli
设置 + 一些组件和视图。
该应用程序构建 vue-cli-service build
在本地运行良好,但是当我尝试在 heroku 上部署它时失败并出现以下错误,
Build
Running build
roh@1.0.0 build /tmp/build_9945eaec
vue-cli-service build
Building for production...
ERROR Failed to compile with 1 error4:21:05 PM
This relative module was not found:
ERROR Build failed with errors.
* ../assets/Logo.png in ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"6212392d-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Header.vue?vue&type=template&id=2778e676&scoped=true&
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! roh@1.0.0 build:
vue-cli-service build
npm ERR! Exit status 1 npm ERR! npm ERR!
Failed at the roh@1.0.0 build script. npm ERR! This is probably not a
problem with npm. There is likely additional logging output above. npm
ERR! A complete log of this run can be found in: npm ERR!
/tmp/npmcache.fDHth/_logs/2021-05-01T16_21_06_022Z-debug.log
-----> Build failed
编辑:
这很奇怪,唯一一次构建失败是在我尝试在 header
组件中添加 img
标记时。代码段非常简单,
<router-link to="/" class="flex title-font font-medium items-center text-gray-900 mb-4 md:mb-0">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="w-10 h-10 text-white p-2 bg-secondary rounded-full" viewBox="0 0 24 24">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
</svg>
<!-- <img class="logo" src="@/assets/Logo.png" alt="Recipe Of Hope" srcset="" /> -->
<span class="ml-3 text-xl text-primary">Recipe of Hope</span>
</router-link>
如果我取消注释 img
标记,构建将失败。
奇怪的是,vscode/git 在我更新图像时没有更改图像(从 logo.png 到 Logo.png)。
事实证明 Mac 文件系统不区分大小写,但 Linux/Windows 区分大小写,这个问题很难追踪,但是一旦你看到它几次就很容易发现.
问题是由于大小写不匹配,在我完全更改图像名称然后恢复为 Logo.png 后它起作用了。
我有一个非常基本的应用程序,默认 vue-cli
设置 + 一些组件和视图。
该应用程序构建 vue-cli-service build
在本地运行良好,但是当我尝试在 heroku 上部署它时失败并出现以下错误,
Build
Running build
roh@1.0.0 build /tmp/build_9945eaec
vue-cli-service build
Building for production...
ERROR Failed to compile with 1 error4:21:05 PM
This relative module was not found:
ERROR Build failed with errors. * ../assets/Logo.png in ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"6212392d-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Header.vue?vue&type=template&id=2778e676&scoped=true& npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! roh@1.0.0 build:
vue-cli-service build
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the roh@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR!
/tmp/npmcache.fDHth/_logs/2021-05-01T16_21_06_022Z-debug.log-----> Build failed
编辑:
这很奇怪,唯一一次构建失败是在我尝试在 header
组件中添加 img
标记时。代码段非常简单,
<router-link to="/" class="flex title-font font-medium items-center text-gray-900 mb-4 md:mb-0">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" class="w-10 h-10 text-white p-2 bg-secondary rounded-full" viewBox="0 0 24 24">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
</svg>
<!-- <img class="logo" src="@/assets/Logo.png" alt="Recipe Of Hope" srcset="" /> -->
<span class="ml-3 text-xl text-primary">Recipe of Hope</span>
</router-link>
如果我取消注释 img
标记,构建将失败。
奇怪的是,vscode/git 在我更新图像时没有更改图像(从 logo.png 到 Logo.png)。
事实证明 Mac 文件系统不区分大小写,但 Linux/Windows 区分大小写,这个问题很难追踪,但是一旦你看到它几次就很容易发现.
问题是由于大小写不匹配,在我完全更改图像名称然后恢复为 Logo.png 后它起作用了。