title: Installing phantomjs using npm error
body: <p>I'm doing a unit testing for my javascript codes. I prefer to use a headless browser for easier running. It goes well when I installed some dependencies but when I install phantomjs, it has an error.</p>
  
  <blockquote>
    <p>C:\Phantomjs>npm install -g phantomjs npm WARN deprecated
    phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Plea se update
    'phantomjs' package references to 'phantomjs-prebuilt' npm WARN
    deprecated node-uuid@1.4.8: Use uuid module instead npm WARN
    deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie
    h ttps://nodesecurity.io/advisories/130
    C:\Users.ra\AppData\Roaming\npm\phantomjs ->
    C:\Users.ra\AppDa
    ta\Roaming\npm\node_modules\phantomjs\bin\phantomjs</p>
    
    <blockquote>
      <p>phantomjs@2.1.7 install C:\Users.ra\AppData\Roaming\npm\node_modules\ phantomjs
      node install.js</p>
    </blockquote>
    
    <p>Considering PhantomJS found at
    C:\Users.ra\AppData\Roaming\npm\phantomj s.CMD Looks like an
    <code>npm install -g</code> on windows; skipping installed version. Downloading
    <a href="https://github.com/Medium/phantomjs/releases/download/v2.1.1//phanto" rel="nofollow noreferrer">https://github.com/Medium/phantomjs/releases/download/v2.1.1//phanto</a>
    mjs-2.1.1-windows.zip Saving to
    C:\Users.ra\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-wind
    ows.zip Using proxy <a href="http://.ra" rel="nofollow noreferrer">http://.ra</a>:******@proxy:3128/ Receiving...</p>
    
    <p>Error making request. Error: tunneling socket could not be
    established, statusCode=502
        at ClientRequest.onConnect (C:\Users.ra\AppData\Roaming\npm\node_mo
    dules\phantomjs\node_modules\tunnel-agent\index.js:165:19)
        at Object.onceWrapper (events.js:320:30)
        at emitThree (events.js:135:13)
        at ClientRequest.emit (events.js:216:7)
        at Socket.socketOnData (_http_client.js:470:11)
        at emitOne (events.js:115:13)
        at Socket.emit (events.js:210:7)
        at addChunk (_stream_readable.js:264:12)
        at readableAddChunk (_stream_readable.js:251:11)
        at Socket.Readable.push (_stream_readable.js:209:10)</p>
    
    <p>Please report this full log at <a href="https://github.com/Medium/phantomjs" rel="nofollow noreferrer">https://github.com/Medium/phantomjs</a> npm
    WARN Error: EPERM: operation not permitted, scandir
    'C:\Users.ra\Ap
    pData\Roaming\npm\node_modules\phantomjs\node_modules\dashdash\node_modules'
    npm WARN  { Error: EPERM: operation not permitted, scandir
    'C:\Users.ra
    \AppData\Roaming\npm\node_modules\phantomjs\node_modules\dashdash\node_modules'
    npm WARN   stack: 'Error: EPERM: operation not permitted, scandir
    \'C:\Users\p
    ardillo.ra\AppData\Roaming\npm\node_modules\phantomjs\node_modules\dashda
    sh\node_modules\'', npm WARN   errno: -4048, npm WARN   code:
    'EPERM', npm WARN   syscall: 'scandir', npm WARN   path:
    'C:\Users\.ra\AppData\Roaming\npm\node_modules\p
    hantomjs\node_modules\dashdash\node_modules' } npm ERR! code
    ELIFECYCLE npm ERR! errno 1 npm ERR! phantomjs@2.1.7 install: <code>node
    install.js</code> npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
    phantomjs@2.1.7 install script. npm ERR! This is probably not a
    problem with npm. There is likely additional log ging output above.`</p>
  </blockquote>
  
  <p>What should I do?</p>