분명히 며칠 전까진 잘 돌던 jest 테스트 케이스가 아래와 같은 메시지를 뱉으며 실패했다. ● Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". Here's what you can do: • If you are trying ..
AWS Lambda에서 이미지 리사이징을 위해 sharp 라이브러리를 사용했을 때, 제목과 같은 오류가 발생할 수 있다. 이는 AWS Lambda의 아키텍쳐와 sharp 라이브러리의 아키텍쳐가 맞지 않기 때문에 발생하는 문제이며, 다음과 같이 node_modules에 sharp를 재설치하여 해결할 수 있다. [~] rm -rf ./node_modules/sharp [~] SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=arm64 --platform=linux sharp [~] 참고 sharp - High performance Node.js image processing sharp.pixelplumbing.com
현상 nest new ./ 명령어를 통해 nest 프로젝트를 구성하려고 했으나, buildDeps에서 멈춤 아래 블로그의 3번 절차를 참고하여 진행했으나 그래도 같은 지점에서 멈춤 일단 참고 링크부터 npm sill idealtree buildDeps에서 멈추는 현상 npm i express --save를 했는데, sill idealTree buildDeps 블라블라에서 진행이 안되어서, 어떻게 하면 할 수 있지 알아봤는데 package-lock.json을 삭제하기 => 안됨 npm install --verbose => 안됨 npm set registry http://regis ggodong.tistory.com 대부분의 경우 위 블로그 방식대로 해결이 된다지만, 나는 'npm set registry h..
AWS lambda 노드 런타임을 사용할 때, 공통 코드를 layer(계층)에 관리하고 있다면 다음과 같이 import하여 사용하게 된다. const myLibrary = require('/opt/myLibrary'); exports.handler = function(event, context) { myLibrary.greeting(); // hello! } 그러나 해당 코드를 로컬에서 테스트하는 경우, 계층에 포함된 라이브러리가 로컬 환경의 /opt 하위 경로에 존재하지 않으므로 모듈을 임포트할 수 없는 문제가 발생한다. jest를 사용하여 테스트하는 경우, jest.config.js에 다음과 같이 작성하여 문제를 쉽게 해결할 수 있다. module.exports = { moduleNameMapper:..
업무 도중에 Node.js로 다음과 같은 기능을 작성할 일이 있었다. 수 많은 Promise를 생성하되, 각각의 Promise는 1:1로 대응되는 stream의 end 또는 error 이벤트에서 상태가 결정된다. Promise.all로 작업이 완료되는 것을 기다린다. 후속 작업을 처리한다. 그런데 await Promise.all(promises); 에서 대기하던 중 Node.js 애플리케이션이 아무런 로그 없이 code 0으로 정상 종료되는 상황이 발생하였다. (물론 코드 전역에 try - catch를 걸어도 어떠한 에러도 잡히지 않았다.) 해당 문제의 원인은 다음과 같으며, 핵심은 stream의 에러 또는 스펙이 아닌 Node.js 동작 방식에 있었다. Node.js는 애플리케이션을 실행할 경우, 이벤..
. ├── app.js └── input.txt 요런 구조일 때, const fs = require('fs'); const { exec } = require('child_process'); // 요 부분은 본인이 원하는대로 후처리한다. // 후처리가 필요없으면 fs.readFileSync만 해도 무방하다. const text = fs.readFileSync('./input.txt', 'utf-8') .trim() .split('\n') .map(line => line.replace('\t', '=')) .join(';'); exec(`echo "${text}" | pbcopy`, ((error, stdout, stderr) => { console.log(stdout); })); 요런 식으로 pbcopy를..
Correct way to convert size in bytes to KB, MB, GB in JavaScript I got this code to covert size in bytes via PHP. Now I want to convert those sizes to human readable sizes using JavaScript. I tried to convert this code to JavaScript, which looks like this: fun... stackoverflow.com 리마인드용으로 작성
- Total
- Today
- Yesterday
- kotlin
- Puppeteer
- AWS IoT
- JPA
- dev
- Spring Cloud Config
- react
- Linux
- Java
- Docker
- Vault
- hashicorp
- spring boot
- etc
- JEST
- shell
- mysql
- Database
- pgloader
- AWS
- Node.js
- eureka
- javascript
- postgresql
- 코딩테스트
- jQuery
- Git
- Gradle
- IntelliJ
- terraform
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |