Nodejs npm sets karma

When I installed karma in nodejs modules, this is written in my log:

npm http 304 https registry.npmjs.org/proto-list > phantomjs@1.9.1-5 install C:\Users\<user>\AppData\Roaming\npm\node_modules\karma-phantomjs-launcher\node_modules\phantomjs > node install.js Downloading http://phantomjs.googlecode.com/files/phantomjs-1.9.1-windows.zip Saving to \tmp\phantomjs\phantomjs-1.9.1-windows.zip Receiving... C:\Users\<user>\AppData\Roaming\npm\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\install.js:215 deferred.reject('Error with http request: ' + util.inspect(response.head ^ ReferenceError: util is not defined at ClientRequest.<anonymous> (C:\Users\<user>\AppData\Roaming\npm\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\install.js:215:53) at ClientRequest.g (events.js:175:14) at ClientRequest.EventEmitter.emit (events.js:95:17) at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1669:21) at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:120:23) at Socket.socketOnData [as ondata] (http.js:1564:20) at TCP.onread (net.js:525:27) npm ERR! weird error 8 npm ERR! not ok code 0 d:\nodejs>npm install util npm http 304 https registry.npmjs.org/events.node util@0.4.9 node_modules\util └── events.node@0.4.9 

the module is already installed. Why is karma not established?

+4
source share
3 answers

I had a similar error (on Linux, though). The point is this:

PhantomJS comes with its own β€œinstaller” install.js , which extracts the pre-compiled PhantomJS binaries to a temporary directory and unzips them somewhere inside your node_modules directory.

I had to export the TMPDIR because /tmp not writable. In your case, it seems that the backup \tmp not cutting it (this is Windows after all). Try installing TMPDIR to point to an existing directory and run npm install again.

Good luck

PS: Can someone extend this answer with instructions on how to set environment variables in Windows?

+2
source

I downloaded fantomjs zip and replaced it with TMPDIR . After that, the installation of karma was started again. And that happened. But when I ran nodejs from a tutorial script, I took the error ... But this is another story ...

+1
source

Here's what worked for me -

PhantomJSZip is loading (at least trying) in

 C:\tmp\phantomjs 

But the file size is 0kb. So I downloaded it from the PhantomJS website and copied it to this place.

All the answers to the two answers are in front of me. I just searched the zip file.

+1
source

Source: https://habr.com/ru/post/1497402/


All Articles