Итак, я получаю эту ошибку NPM, и я не могу понять, почему просто VUE не может быть решена. Я использую Laravel 5.6. Это новая установка Laravel с легкой настройкой веб-пакета. Я определил путь в webpackConfig к VUE и считаю, что он не работает на этапе извлечения в webpack.mix.js
Vue установлен в node_modules / vue
ошибка генерируется с использованием npm run dev и npm run prod
Package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.10",
"axios": "^0.18",
"babel-jest": "^22.1.0",
"bootstrap": "^4.1.3",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.5",
"pace": "github:HubSpot/pace#v1.0.2",
"perfect-scrollbar": "^1.4.0",
"popper.js": "^1.14.4",
"simple-line-icons": "^2.4.1",
"sweetalert2": "^7.0.7",
"vue": "^2.5.17"
},
"dependencies": {
"imagemin": "^6.0.0"
}
}
webpack.mix.js
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.setPublicPath('public');
/*
|--------------------------------------------------------------------------
| Webpack Config
|--------------------------------------------------------------------------
*/
mix.webpackConfig({
resolve: {
modules: [
path.resolve(__dirname, 'node_modules/bootstrap/dist'),
path.resolve(__dirname, 'node_modules/jquery/dist'),
path.resolve(__dirname, 'node_modules/vue'),
path.resolve(__dirname, 'node_modules/axios/dist'),
path.resolve(__dirname, 'node_modules/lodash'),
path.resolve(__dirname, 'node_modules/sweetalert2/dist'),
path.resolve(__dirname, 'node_modules/popper.js/dist')
]
}
});
/*
|--------------------------------------------------------------------------
| Vendor Extraction
|--------------------------------------------------------------------------
*/
mix.extract([
'vue',
'jquery',
'axios',
'sweetalert2',
'lodash',
'js/bootstrap',
'popper.js'
]);
/*
|--------------------------------------------------------------------------
| Autoload Dependancies
|--------------------------------------------------------------------------
*/
mix.autoload({
jquery: ['$', 'window.jQuery', 'jQuery']
});
/*
|--------------------------------------------------------------------------
| Mix App Resources
|--------------------------------------------------------------------------
| app.js | Application Javascript file
| app.scss | Applciation SCSS file
*/
mix
.js(['resources/js/app.js'], 'public/js')
.sass('resources/sass/app.scss', 'public/css');
/*
|--------------------------------------------------------------------------
| Mix In Production
|--------------------------------------------------------------------------
*/
if (mix.inProduction() || process.env.npm_lifecycle_event !== 'hot') {
mix.version();
}
Ошибка NPM
ERROR in multi vue jquery axios sweetalert2 lodash js/bootstrap popper.js
Module not found: Error: Can't resolve 'vue' in '/Path/To/Project/Project-Folder'
@ multi vue jquery axios sweetalert2 lodash js/bootstrap popper.js
app.js
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('example-component', require('./components/ExampleComponent.vue'));
const app = new Vue({
el: '#app'
});