Site icon 엘스트림

라라벨 5.4 gulp 또는 npm run watch 해결 방법

라라벨 5.4에서는 gulp 명령어가 npm run watch로 바뀌어서 프런트 엔드를 빌드해야 한다.

그런데 npm run watch를 하면 다음과 같은 에러가 뜬다.

> node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules /webpack/bin/webpack.js –progress –hide-modules –config=node_modules/laravel- mix/setup/webpack.config.js

module.js:471
throw err;
^

Error: Cannot find module ‘C:\Users\hnefo\sites\collection\node_modules\cross-en v\bin\cross-env.js’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:393:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:508:3

npm ERR! Windows_NT 10.0.14393
npm ERR! argv “C:\\Program Files\\nodejs\\node.exe” “C:\\Program Files\\nodejs\\ node_modules\\npm\\bin\\npm-cli.js” “run” “dev”
npm ERR! node v6.10.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=developme nt node_modules/webpack/bin/webpack.js –progress –hide-modules –config=node_m odules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script ‘node node_modules/cross-env/bin/cross-env.j s NODE_ENV=development node_modules/webpack/bin/webpack.js –progress –hide-mod ules –config=node_modules/laravel-mix/setup/webpack.config.js’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node node_modules/cross-env/bin/cross-env.js NODE_ENV=development n ode_modules/webpack/bin/webpack.js –progress –hide-modules –config=node_modul es/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\hnefo\sites\collection\npm-debug.log


이는 package.json의 watch의 경로가 잘못돼서 그런 것이다. 

“cross-env/bin/” 대신에 “cross-env/dist/bin”를 사용해 주자.

라라벨 팀에서 개선해 주지 않을까 싶다.

참고 : https://github.com/JeffreyWay/laravel-mix/issues/521

 

Exit mobile version