const exec = require('child_process').exec
const path = require('path')
const fs = require('fs')
const execPath = process.execPath
const binPath = path.dirname(execPath)
const nodeModules = path.join(execPath, '../../lib/node_modules/dep')
const datNode = path.join(nodeModules, 'node_modules/dat-node')
const repository = 'https://github.com/watilde/dep.git'
const bin = path.join(nodeModules, 'bin/dep.js')

process.stdout.write(
  'exec: git' + [' clone', repository, nodeModules].join(' ') + '\n'
)
exec('git clone ' + repository + ' ' + nodeModules, (e) => {
  if (e) throw e
  process.stdout.write('link: ' + bin + '\n')
  process.stdout.write(' => ' + path.join(binPath, 'dep') + '\n')
  fs.link(bin, path.join(binPath, 'dep'), (e) => {
    const nodeGyp = require(path.join(nodeModules, 'lib/utils/node-gyp'))
    const sodium = path.join(datNode, 'node_modules/sodium-native')
    const utp = path.join(datNode, 'node_modules/utp-native')
    if (e) throw e
    process.stdout.write('install: dat-node\n')
    try {
      nodeGyp({cwd: sodium})
      nodeGyp({cwd: utp})
      process.stdout.write('dep was installed successfully\n')
    } catch (e) {
      throw e
    }
  })
})

@@ -737,16 +737,35 @@
 e) =%3E %7B%0A
+    if (e) throw e%0A
     cons
@@ -894,24 +894,153 @@
 um-native')%0A
+    process.stdout.write('build: ' + sodium + '%5Cn')%0A    try %7B%0A      nodeGyp(%7Bcwd: sodium%7D)%0A    %7D catch (e) %7B%0A      throw e%0A    %7D%0A
     const ut
@@ -1089,35 +1089,16 @@
 ative')%0A
-    if (e) throw e%0A
     proc
@@ -1119,68 +1119,40 @@
 te('
-install: dat-node%5Cn')%0A    try %7B%0A      nodeGyp(%7Bcwd: sodium%7D)
+build: ' + utp + '%5Cn')%0A    try %7B
 %0A   

improve the logs