laravel 5.4 npm install 실패시

laravel 5.4 npm install 실패시

laravel 5.4에서는 기본적으로 webpack을 사용하도록 설정이 되어있는데

homestead 환경에서 laravel 5.4 프로젝트를 클린 설치 후에도 npm install 을 실행하면 여러가지 오류가 나고

오류를 겨우 메워서 설치를 완료한 뒤에도

npm run dev 를 실행해도 계속 여러가지 오류가 나타나서 꽤나 골치가 아팠는데

깔끔하게 정리되어있는 답변이 있어서 정리해둔다.

(참고로 내가 사용한 환경은 window7, virtualbox 환경에서 homestead를 사용했다)

핵심은

cross-env를 글로벌 설치할것

그리고 윈도우를 호스트로 하는 경우는 --no-bin-links 옵션을 반드시 넣을것

그리고 마지막으로 node-sass를 --no-bin-links 옵션으로 다시 빌드할것

sudo rm node_modules/ -rf

# this avoid problem with `cross-env not found`

sudo npm install cross-env -g

# Execute two times to resolve the problem with ` Maximum call stack size exceeded`

# while finalizing

# Also note: I'm using --no-bin-links because I've a Windows 7 host

npm install --no-bin-links || npm install --no-bin-links

# this avoid problem with `Module build failed: ModuleBuildError: Module build failed:

# Error: ENOENT: no such file or directory, scandir

#'/home/vagrant/Code//node_modules/node-sass/vendor' `

npm rebuild node-sass --no-bin-links

참고

https://www.bountysource.com/issues/42450808-cannot-find-module-cross-env

from http://trend21c.tistory.com/1985 by ccl(A) rewrite - 2020-03-06 23:55:21

댓글

이 블로그의 인기 게시물

[PHP] 라라벨 루멘 DB문서 자동화

[Laravel] multiple Database using

Laravel(라라벨) Homestead 사용하기