Issue installing JSDOM on mac

Viewed 4459

Using this command: npm install jsdom, in an attempt to get jsdom up and running to use with a node.js server, I get the following series of errors. Could somebody please help clarify this issue? I think that there might also be an issue because it cannot install contextify...thanks in advance!

npm http GET https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/htmlparser
npm WARN package.json cssom@0.2.5 No README.md file found!
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> contextify@0.1.3 install /Users/dereklo/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild

gyp ERR! rebuild error Error: not found: make
gyp ERR! rebuild error     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:28)
gyp ERR! rebuild error     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! rebuild error     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! rebuild error     at Object.oncomplete (fs.js:297:15)
gyp ERR! not ok 
npm WARN optional dep failed, continuing contextify@0.1.3
jsdom@0.2.15 node_modules/jsdom
├── cssom@0.2.5
└── htmlparser@1.7.6
3 Answers

The above didn't work for me (Node version 16.13.0 on Mac). I noticed part of the error node-pre-gyp WARN Pre-built binaries not installable for canvas@2.6.1 and node@16.13.0.

So I used Node version 14.18.2 (using NVM) instead which is fine in my case.
(I think that skips compiling and uses a prebuilt version.)

Then npm install worked as expected.

Related