Created
July 8, 2019 12:33
-
-
Save otwm/1a0a7b758cb102c098eb2cb79f6e7834 to your computer and use it in GitHub Desktop.
node-gyp 설치 오류(sentry)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
일부 패키지 설치시 오류가 발생할 수 있다. 패키지 내에 c/c++ 라이브러리를 설치하는 경우 권한에 따른 에러가 발생하게 된다. | |
sentry 역시 그렇다. 로컬에선 별 문제 없다가 aws에서 문제가 발생한다. | |
설치 과정에서 추적하다보면 node scripts/install.js 라인에서 발생하고, 해당 디버그 메세지는 아래와 같다. | |
================================================================================================================ | |
2916 info lifecycle @sentry/[email protected]~install: @sentry/[email protected] | |
2917 verbose lifecycle @sentry/[email protected]~install: unsafe-perm in lifecycle false | |
2918 verbose lifecycle @sentry/[email protected]~install: PATH: /opt/elasticbeanstalk/node-install/node-v8.14.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/tmp/deployment/application/node_modules/@sentry/cli/node_modules/.bin:/tmp/deployment/application/node_modules/.bin:/opt/elasticbeanstalk/node-install/node-v8.14.0-linux-x64/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin | |
2919 verbose lifecycle @sentry/[email protected]~install: CWD: /tmp/deployment/application/node_modules/@sentry/cli | |
2920 silly lifecycle @sentry/[email protected]~install: Args: [ '-c', 'node scripts/install.js' ] | |
2921 silly lifecycle @sentry/[email protected]~install: Returned: code: 1 signal: null | |
2922 info lifecycle @sentry/[email protected]~install: Failed to exec install script | |
2923 verbose stack Error: @sentry/[email protected] install: `node scripts/install.js` | |
2923 verbose stack Exit status 1 | |
2923 verbose stack at EventEmitter.<anonymous> (/opt/elasticbeanstalk/node-install/node-v8.14.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16) | |
2923 verbose stack at emitTwo (events.js:126:13) | |
2923 verbose stack at EventEmitter.emit (events.js:214:7) | |
2923 verbose stack at ChildProcess.<anonymous> (/opt/elasticbeanstalk/node-install/node-v8.14.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) | |
2923 verbose stack at emitTwo (events.js:126:13) | |
2923 verbose stack at ChildProcess.emit (events.js:214:7) | |
2923 verbose stack at maybeClose (internal/child_process.js:915:16) | |
2923 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) | |
2924 verbose pkgid @sentry/[email protected] | |
================================================================================================================ | |
이는 권한에 따른 문제이며, unsafe-perm config 설정에 따른다. 이는 기본적으로는 false이며, root가 아닌 유저가 이런 외부 라이브러리를 설치할 때, 에러가 발생하는 것으로 | |
생각된다. 로컬에서는 권한이 있기에 문제가 없지만, 라이브 서버에서는 문제가 발생할 수 있다. | |
가능하면 .npmrc에 unsafe-perm 를 true로 하는 것을 권장한다. | |
Unsafe-perm Default: false if running as root, true otherwise | |
Type: Boolean | |
Set to true to suppress the UID/GID switching when running package scripts. If set explicitly to false, then installing as a non-root user will fail. | |
https://docs.npmjs.com/misc/config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment