我最近在webpack build上遇到了这个错误。
ERROR Failed to compile with 3 errors
These relative modules were not found:
* ./components/component1.vue in ./resources/assets/js/lmi/app.js
* ./components/component2.vue in ./resources/assets/js/lmi/app.js
* ./components/component3.vue in ./resources/assets/js/lmi/app.js
document.addEventListener("DOMContentLoaded", function() {
const Vue = require('vue');
// Register all our parent components
Vue.component('component1', require('./components/component1.vue'));
Vue.component('component2', require('./components/component2.vue'));
Vue.component('component3', require('./components/component3.vue'));
// Initialise the root vue instance.
const app = new Vue({
el: '#app'
});
});
过去常常工作,我已检查过较旧的分支机构并再次运行npm
install
。
我已经尝试在require语句中列出绝对路径,如果我这样做,我会收到此错误:
ERROR Failed to compile with 3 errors 12:14:37 PM
These dependencies were not found:
/resources/assets/js/lmi/components/hourly-wage.vue in ./resources/assets/js/lmi/app.js
/resources/assets/js/lmi/components/search.vue in ./resources/assets/js/lmi/app.js
/resources/assets/js/lmi/components/hiring-demand.vue in ./resources/assets/js/lmi/app.js
To install them, you can run: npm install --save /resources/assets/js/lmi/components/hourly-wage.vue /resources/assets/js/lmi/components/search.vue /resources/assets/js/lmi/components/hiring-demand.vue
我不确定发生了什么。有人能指出我正确的方向吗?
答案 0 :(得分:0)
找到答案。这是一个NPM问题。我有一个工作同事在他的机器上运行相同的命令,它工作。因此,为了缩小范围我快速安装纱线,看它是否会起作用,它确实......
npm 5.4.2是我遇到过的版本。