본문 바로가기
프로그램개발/ClientSide(JavaScript,Angular,Vue)

node-sass 설치 과정 오류 (Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass)

by 크레도스 2020. 10. 21.

나만 그런지 모르겠는데 gem sass는 잘 설치 되던데 node-sass를 설치하려고 하니 자꾸 에러가 떠서 환장하는 줄 알았다.

보통은

sudo npm install -g node-sass 

라고 입력하면 다 잘되던데..ㅠ 나는 이렇게 뜨더라..

gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@12.14.1 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.16
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 12.14.1
gyp verb command install [ '12.14.1' ]
gyp verb install input version string "12.14.1"
gyp verb install installing version: 12.14.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 12.14.1
gyp verb ensuring nodedir is created /Users/a./.node-gyp/12.14.1
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/a./.node-gyp/12.14.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '--node_gyp_internal_noretry', '12.14.1' ]
gyp verb install input version string "12.14.1"
gyp verb install installing version: 12.14.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 12.14.1
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/node-sass/.node-gyp/12.14.1
gyp WARN install got an error, rolling back install
gyp verb command remove [ '12.14.1' ]
gyp verb remove using node-gyp dir: /usr/local/lib/node_modules/node-sass/.node-gyp
gyp verb remove removing target version: 12.14.1
gyp verb remove removing development files for version: 12.14.1
gyp WARN install got an error, rolling back install
gyp verb command remove [ '12.14.1' ]
gyp verb remove using node-gyp dir: /usr/local/lib/node_modules/node-sass/.node-gyp
gyp verb remove removing target version: 12.14.1
gyp verb remove removing development files for version: 12.14.1
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/.node-gyp'
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /usr/local/lib/node_modules/node-sass
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.13.1 postinstall 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/a./.npm/_logs/2020-02-01T16_00_21_577Z-debug.log

나는 안되더라 그래서 나같이 헤매는 사람들을 위해 글을 남겨둔다.

sudo npm install -g --unsafe-perm node-sass

라고 한번 입력해 봐라. 그런뒤 정상적으로 설치되었다고 생각되면,

node-sass -v

를 입력해주면,

node-sass       4.13.1  (Wrapper)       [JavaScript]
libsass         3.5.4   (Sass Compiler) [C/C++]

라고 뜨면서 잘 설치된 모습을 볼 수 있다.

 

출처 : so-tired.tistory.com/47