前提・実現したいこと
HerokuにPushしたLaravelアプリに Vue を反映させるため、Herokuのbash内でnpm run dev
を実行したいのですが、以下のエラーが生じてしまい、上手く Vue が聞いてくれません。
もし何か思いつく方がいらっしゃれば教えて頂きたいです。
発生している問題
> 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 events.js:292 throw er; // Unhandled 'error' event ^ Error: spawn node_modules/webpack/bin/webpack.js ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19) at onErrorNT (internal/child_process.js:465:16) at processTicksAndRejections (internal/process/task_queues.js:80:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) at onErrorNT (internal/child_process.js:465:16) at processTicksAndRejections (internal/process/task_queues.js:80:21) { errno: -2, code: 'ENOENT', syscall: 'spawn node_modules/webpack/bin/webpack.js', path: 'node_modules/webpack/bin/webpack.js', spawnargs: [ '--progress', '--hide-modules', '--config=node_modules/laravel-mix/setup/webpack.config.js' ] }
該当のソースコード
packagejson
1{ 2 "private": true, 3 "scripts": { 4 "heroku-postbuild": "npm run prod", 5 "dev": "npm run development", 6 "development": "mix", 7 "watch": "mix watch", 8 "watch-poll": "mix watch -- --watch-options-poll=1000", 9 "hot": "mix watch --hot", 10 "prod": "npm run production", 11 "production": "mix --production" 12 }, 13 "devDependencies": { 14 "@johmun/vue-tags-input": "^2.1.0", 15 "axios": "^0.19", 16 "cross-env": "^5.1", 17 "laravel-mix": "^4.0.7", 18 "lodash": "^4.17.13", 19 "resolve-url-loader": "^2.3.1", 20 "sass": "^1.15.2", 21 "sass-loader": "^7.1.0", 22 "vue": "^2.6.11", 23 "vue-template-compiler": "^2.6.11" 24 } 25}
webpackmixjs
1const mix = require('laravel-mix'); 2 3/* 4 |-------------------------------------------------------------------------- 5 | Mix Asset Management 6 |-------------------------------------------------------------------------- 7 | 8 | Mix provides a clean, fluent API for defining some Webpack build steps 9 | for your Laravel application. By default, we are compiling the Sass 10 | file for the application as well as bundling up all the JS files. 11 | 12 */ 13 14mix.js('resources/js/app.js', 'public/js') 15 .sass('resources/sass/app.scss', 'public/css') 16 .version(); 17
試したこと
heroku run bash
- npm install cross-env -g
- npm install --save
上の二つでダメだったので、以下も試してみたが、上手くいかず。
- npm install -g npm
- npm install --global cross-env
環境
laravel 6.x
npm 6.14.8
node 14.15.0
あなたの回答
tips
プレビュー