npm run devのエラーについて
利用しているソフトウェア
OS:windows10
Laravel Framework 8.18.1
npm-v6.14.9
webpack@5.11.0
Laravelでnpmを利用したいと思い、インストール、アンインストール、再インストールを繰り返したのですが、どうも
npm run devやブラウザのコンソール上でエラーが出てしまい困っています。
webpackやnpmについての理解が浅いことは重々承知しているのですが、お力をお借りできないでしょうか??
まず、npm run dev 実行時のエラー
C:\workspace\neomediaproject>npm run dev
> packege.json@1.0.0 dev C:\workspace\neomediaproject
> webpack --mode development
[webpack-cli] Compilation finished
asset main.js 644 bytes [compared for emit] (name: main)
ERROR in main
Module not found: Error: Can't resolve './src' in 'C:\workspace\neomediaproject'
webpack 5.11.0 compiled with 1 error in 78 ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! packege.json@1.0.0 dev: `webpack --mode development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the packege.json@1.0.0 dev 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! C:\Users\m_i\AppData\Roaming\npm-cache\_logs\2020-12-21T06_06_22_146Z-debug.log
以前のバージョンではwebpack.config.jsを利用していたらしいのですが最新ではwebpack.mix.jsにかわってので内容を記載しておきます。
const 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.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');