JavaScript
[Node.js] ReferenceError: primordials is not defined
코딩하는 Jay
2021. 2. 9. 11:46
반응형
현재 노드를 이용해서 자동화 프로그램 하나 작성하고 있습니다. 내부에서 아래와 같이 fs와 unzip 패키지를 동시에 사용하고 있습니다.
const fs = require('fs'),
unzip = require('unzip');
그런데, 아래와 같이 에러가 발생합니다.
$ node app.js
fs.js:27
const { Math, Object } = primordials;
^
ReferenceError: primordials is not defined
at fs.js:27:26
검색해보니, node 12버전과 gulf 3버전을 사용하면 이렇게 에러가 발생하는 것 같습니다. 어쩔 수 없이 node를 다운그레이드 하기로 했습니다.
먼저, n 패키지를 설치합니다.
$ sudo npm install -g n
그리고 아래 명령어를 이용해 node 10.16.0 버전으로 다운그레이드 합니다.
$ sudo n 10.16.0
이제 잘 동작합니다!
출처:
stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node
How to fix ReferenceError: primordials is not defined in node
I have installed node modules by npm install, then I tried to do gulp sass-watch in command prompt. After that I got the below response. [18:18:32] Requiring external module babel-register fs.js:27
stackoverflow.com
반응형