Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs npm install karma

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

npm http 304 https registry.npmjs.org/proto-list

> [email protected] 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
[email protected] node_modules\util
└── [email protected]

module util already installed. Why karma not installing?

like image 200
DArt Avatar asked Aug 13 '26 14:08

DArt


1 Answers

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

PhantomJS comes with it's own "installer" install.js that is fetching the precompiled PhantomJS binaries to a temporary directory and unzips them to somewhere inside your node_modules directory.

I had to export the TMPDIR variable because /tmp was not writable. In your case it looks like the \tmp fallback doesn't cut it (it's Windows after all). Try setting TMPDIR to point to an existing directory and run npm install again.

Good luck!

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

like image 179
svckr Avatar answered Aug 16 '26 05:08

svckr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!