목록자바스크립트 (92)
바르고 뜨겁게
AWS Lightsail - Nodejs + mySql 배포1. cross-env 설치동적으로 process.env 변경 (개발 환경과 로컬 환경 분리) npm i -g cress-env && npm i cross-envpackage.json "scripts":{ "start": "cross-env NODE_ENV=production PORT=80 node ./bin/www", "dev": "node ./bin/www" } // start 에선 process.env.NODE_ENV 를 production 으로 변경하고 있음 // 변경하는 env 값은 app.js 에서 사용중 // 포트도 80 으로 변경 npm start // 배포환경 npm run dev // 개발 환경2. pm2 설치에러로 서버가 ..
express 프레임워크 기반 node js 서버 세팅express 패키지 전역 설치npm -i -g express-generator express 프레임워크 기반 워크스페이스 폴더 생성express [폴더명] --view=[뷰엔진] express 실행에 필요한 패키지 설치cd [폴더명] npm i 서버 실행// package.json 파일내에 scripts(사용자 정의 명령어) 안에 있는 // start 에 의해 npm run start로 실행가능 (run 생략가능) npm run start
JavaScript - dot(.) 점이 있는 JSON parsing Object : {gcm.notification.body: "테스트 메시지", gcm.notification.title: "테스트 타이틀"} 위와 같은 형태의 JSON 은 Object.gcm.notification.body 형태로 파싱하면 에러가 난다.Object.['gcm.notification.body'] 이렇게 파싱해야 에러없이 원하는 값을 얻을 수 있다.
ReactNative - SoundPlayer 사용법패키지 추가https://www.npmjs.com/package/react-native-sound-playerimport SoundPlayer from 'react-native-sound-player';안드로이드사용할 음악 파일을 아래 경로에 위치 시킨다./android/app/src/main/res/raw/ring.mp3아이폰xCode 에서 위에 위치 시킨 파일을 스크린샷 처럼 추가 한다. 사용 try { SoundPlayer.loadSoundFile('dial', 'mp3'); SoundPlayer.play(); } catch (e) { console.log(`cannot play the sound file`, e) }
react-native webRTC normal arm64 Error리액트 네이티브에서 webRTC 패키지를 적용하고 아이폰에 빌드시 아래와 같은 에러가 난다.** BUILD FAILED ** The following build commands failed: Ld [프로젝트 경로] normal arm64 (1 failure)xCode 에서 좀 더 자세히 보면'[프로젝트 경로]' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. fil..
React-Native run-ios —device 빌드 에러react-native 에서 아이폰 장비로 빌드시 에러react-native run-ios --device [아이폰 장비 이름]error Failed to install the app on the device because we couldn't execute the "ios-deploy" command. Please install it by running "npm install -g ios-deploy" and try again. Run CLI with --verbose flag for more details.ios-deploy 설치 시도 또 에러sudo npm install -g ios-deploy** BUILD FAILED ** npm ..
setInterval 사용시 func.apply is not a function 에러자바스크립트에서는 함수 호출 자리에 함수의 이름이 아니라 함수명() 처럼 코딩시 정의된 함수가 즉시 호출되어 버린다.따라서 아래와 같이 코딩하면 func.apply is not a function 에러를 만나게 된다. 잘못된 사용법_myFunc = () => { ... } this._timerId = setInterval(this.myFunc(),1000);코드 실행시 즉시 1번 호출이 되고, 10초 뒤엔 func.apply is not a function 에러를 만나게 된다.의도는 myFunc() 함수를 10초마다 호출하여 실행하는 것이지만, 해결 방법_myFunc = () => { ... } this._time..
* navigation을 이용한 전달Req.jsnavigation.navigate("Res", { REQ_NO: "112233", REQ_DATA: "abcd" });Res.js const { navigation } = this.props; const REQ_NO = navigation.getParam("REQ_NO"); const REQ_DATA = navigation.getParam("REQ_DATA");
root 폴더에서 아래 명령어 입력cd android && ./gradlew signingReport 아래 정보들을 얻을 수 있다Variant , Config , Store , Alias , MD5 , SHA1 , SHA-256 , Valid. until
React native 에서 그림자 적용시안드로이드의 경우 elevation 값에 따른 그림자 변경만 허용하므로,아이폰과 안드로이드 두 플랫폼의 스타일을 각각 적용해야 한다. ...Platform.select({ ios: { shadowColor: "rgb(50, 50, 50)", shadowOpacity: 0.5, shadowRadius: 5, shadowOffset: { height: -1, width: 0 } }, android: { elevation: 5 } })