IT/잡다구리

npm run dev error, node modules 에러

월공 2020. 12. 3. 08:41
728x90
300x250

npm run dev 명령어를 쳤는데 계속 아래와 같은 에러가 출력된다

 

-------npm run dev error------

#이것도 뜨고
node_modules/cross-env/src/index.js:23

#이것도 뜨고
npm ERR! cb.apply is not a function

#이것도 뜨고
npm ERR! Linux 3.10.0-1127.19.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "development" "--" "--watch"
npm ERR! node v6.17.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ development script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"'.
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!     cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
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 버전이 너무낮아서 그런거라고 한다

node -v , npm -v 로 각각 버전 확인을 해보니 

node 는 6.17.1 npm 은 3.10.10

그래서 npm 업그레이드를 하려고 명령어를 쳤는데

#요것도 해보고
npm i -g npm-upgrade

#이것도 해보고
npm i -g npm@latest

 

아래와 같은 에러가 뜬다

sh-4.2# npm i -g npm-upgrade
npm ERR! Linux 3.10.0-1127.19.1.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/bin/npm" "i" "-g" "npm-upgrade"
npm ERR! node v14.15.1
npm ERR! npm  v3.10.10

npm ERR! cb.apply is not a function
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Linux 3.10.0-1127.19.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "i" "-g" "npm@latest"
npm ERR! node v6.17.1
npm ERR! npm  v3.10.10
npm ERR! path /usr/lib/node_modules/npm/node_modules/fs-write-stream-atomic
npm ERR! code EEXIST
npm ERR! errno -17
npm ERR! syscall mkdir

npm ERR! EEXIST: file already exists, mkdir '/usr/lib/node_modules/npm/node_modules/fs-write-stream-atomic'
npm ERR! File exists: /usr/lib/node_modules/npm/node_modules/fs-write-stream-atomic
npm ERR! Move it away, and try again.

위 에러중에 file already exists 라고 하며 /usr/lib/node_modules 어쩌고 경로가 이미 있다 라고하길래

열받아서 usr/lib 폴더 내부에 node_modules 폴더를 아예 날려버렸다.

 

날려버리고나서 다시 npm i -g npm@latest 를치니까 정상작동한다 -_- ;

 

아래 명령어는 에러 찾다가 찾은것들인데 뭐 모듈 충돌할때 캐시를 청소해주는 역할 해준다고 한다

이번 문제해결에는 도움은 안됐지만 그래도 알고있으면 좋을거같아 메모

npm cache clean -f

 

728x90
300x250