npm run dev
可以运行起来,
但是运行
npm run build 后就提示
Could not resolve './assets/img/home/preview/01.jpg' from src\components\DemosSection.vue
这个图片路径是不存在的,我没有这个图片,
为什么不可以打包啊?坑,巨坑
使用的是vs code
<template>
<header class="bg-light shadow-sm navbar-sticky">
<div class="navbar navbar-expand-lg navbar-light">
<div class="container">
<a class="navbar-brand d-none d-sm-block me-4 order-lg-1" href="index.html">
<img src="../public/img/logo-dark.png" width="142" alt="Cartzilla" />
</a>
具体错误内容: <img src="../public/img/logo-dark.png" width="142" alt="Cartzilla" />
所有错误内容:
npm run build
@0.0.0 build D:\CodeDemo\VuejsApp\blog
vue-tsc --noEmit && vite build
vite v2.4.2 building for production...
✓ 10 modules transformed.
Could not resolve './assets/img/home/preview/01.jpg' from src\components\DemosSection.vue
error during build:
Error: Could not resolve './assets/img/home/preview/01.jpg' from src\components\DemosSection.vue
at error (D:\CodeDemo\VuejsApp\blog\node_modules\rollup\dist\shared\rollup.js:151:30)
at ModuleLoader.handleResolveId (D:\CodeDemo\VuejsApp\blog\node_modules\rollup\dist\shared\rollup.js:19797:24)
at D:\CodeDemo\VuejsApp\blog\node_modules\rollup\dist\shared\rollup.js:19746:22
at async Promise.all (index 2)
at async ModuleLoader.fetchStaticDependencies (D:\CodeDemo\VuejsApp\blog\node_modules\rollup\dist\shared\rollup.js:19744:34)
at async Promise.all (index 0)
at async ModuleLoader.fetchModule (D:\CodeDemo\VuejsApp\blog\node_modules\rollup\dist\shared\rollup.js:19720:9)
at async Promise.all (index 4)
at async ModuleLoader.fetchStaticDependencies (D:\CodeDemo\VuejsApp\blog\node_modules\rollup\dist\shared\rollup.js:19744:34)
at async Promise.all (index 0)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @0.0.0 build: vue-tsc --noEmit && vite build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.