前提・実現したいこと
Laravelアプリに Vue を反映させるため、npm run dev
を実行したいのですが、噛み合わないパッケージをインストールしたせいか、また、慌てて npm のコマンドを実行しまくったせいか、どんな方法を試してみても上手くいきません。
もし何か思いつく方がいらっしゃれば教えて頂きたいです。
発生している問題
sh: mix: command not found npm ERR! code ELIFECYCLE npm ERR! syscall spawn npm ERR! file sh npm ERR! errno ENOENT npm ERR! @ development: `mix` npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the @ development 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! /Users/ユーザー名/.npm/_logs/2021-06-13T~Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ dev: `npm run development` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ 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! /Users/ユーザー名/.npm/_logs/2021-06-13T~Z-debug.log
該当のソースコード
packagejson
{ "private": true, "scripts": { "heroku-postbuild": "npm run prod", "dev": "npm run development", "development": "mix", "watch": "mix watch", "watch-poll": "mix watch -- --watch-options-poll=1000", "hot": "mix watch --hot", "prod": "npm run production", "production": "mix --production" }, "devDependencies": { "@johmun/vue-tags-input": "^2.1.0", "axios": "^0.19", "cross-env": "^5.1", "laravel-mix": "^4.0.7", "lodash": "^4.17.13", "resolve-url-loader": "^2.3.1", "sass": "^1.15.2", "sass-loader": "^7.1.0", "vue": "^2.6.11", "vue-template-compiler": "^2.6.11" } }
webpackmixjs
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') .version();
試したこと
1rm -rf node_modules && rm package-lock.json && npm cache clear --force && npm install && npm run dev
これを試したらいいとの記述がちらほら見られたので、あまり意味もわからず実行しました。
環境
laravel 6.x
npm 6.14.8
node 14.15.0
まだ回答がついていません
会員登録して回答してみよう