title: Protractor E2E Testing - E/launcher - Error: Error: Cannot find module 'wd'
body: <p>I'm trying exuceted a automated test with protractor, so when my app open and try write in input field, return this message:</p>
  
  <p>C:\Projetos\Pessoal\ionic_app\tests (master)</p>
  
  <p>protractor conf.js</p>
  
  <pre><code>[09:23:42] I/launcher - Running 1 instances of WebDriver
  [09:23:42] I/hosted - Using the selenium server at http://localhost:4723/wd/hub
  [09:25:07] E/launcher - Error: Error: Cannot find module 'wd'
      at Function.Module._resolveFilename (module.js:469:15)
      at Function.Module._load (module.js:417:25)
      at Module.require (module.js:497:17)
      at require (internal/module.js:20:19)
      at onPrepare (C:\Projetos\Pessoal\ionic_app\tests\conf.js:18:18)
      at q_1.Promise (C:\Users\c1401314\AppData\Roaming\npm\node_modules\protractor\lib\util.ts:48:39)
      at Function.promise (C:\Users\c1401314\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:682:9)
      at Object.runFilenameOrFn_ (C:\Users\c1401314\AppData\Roaming\npm\node_modules\protractor\lib\util.ts:39:10)
      at plugins_.onPrepare.then (C:\Users\c1401314\AppData\Roaming\npm\node_modules\protractor\lib\runner.ts:103:21)
      at _fulfilled (C:\Users\c1401314\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:834:54)
  [09:25:07] E/launcher - Process exited with error code 100enter code here
  </code></pre>
  
  <p>I'm used Appium and Genymotion to emulated my Android Device</p>
  
  <p>Appium return:</p>
  
  <pre><code>    [Appium] Welcome to Appium v1.6.5
      [Appium] Appium REST http interface listener started on 0.0.0.0:4723
      [HTTP] --&gt; POST /wd/hub/session {"desiredCapabilities":{"platformName":"android","platformVersion":"7.0","deviceName":"Nexus","browserName":"","autoWebview":true,"app":"C:\\appium_drivers\\apks\\android-release.apk","count":1}}
      [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"platformName":"android","platformVersion":"7.0","deviceName":"Nexus","browserName":"","autoWebview":true,"app":"C:\\appium_drivers\\apks\\android-release.apk","count":1},null,null]
      [debug] [BaseDriver] Event 'newSessionRequested' logged at 1503057934342 (09:05:34 GMT-0300 (Hora oficial do Brasil))
      [Appium] Creating new AndroidDriver (v1.24.3) session
      [Appium] Capabilities:
      [Appium]   platformName: 'android'
      [Appium]   platformVersion: '7.0'
      [Appium]   deviceName: 'Nexus'
      [Appium]   browserName: ''
      [Appium]   autoWebview: true
      [Appium]   app: 'C:\\appium_drivers\\apks\\android-release.apk'
      [Appium]   count: 1
  [debug] [Chromedriver] Changed state to 'online'
  [Appium] New AndroidDriver session created successfully, session 967301ea-6ced-4801-9f5a-e3d6b68c2e7f added to master session list
  [debug] [BaseDriver] Event 'newSessionStarted' logged at 1503059100927 (09:25:00 GMT-0300 (Hora oficial do Brasil))
  [debug] [MJSONWP] Responding to client with driver.createSession() result: {"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"android","platformVersion":"7.0","deviceName":"Nexus","browserName":"","autoWebview":true,"app":"C:\\appium_drivers\\apks\\android-release.apk","count":1},"platformName":"android","platformVersion":"7.0","deviceName":"192.168.104.101:5555","browserName":"","autoWebview":true,"app":"C:\\appium_drivers\\apks\\android-release.apk","count":1,"deviceUDID":"192.168.104.101:5555","deviceScreenSize":"1200x1920","deviceModel":"Nexus","deviceManufacturer":"Genymotion","appPackage":"br.com.bematech.staff","appWaitPackage":"br.com.bematech.staff","appActivity":"br.com.bematech.staff.MainActivity","appWaitActivity":"br.com.bematech.staff.MainActivity"}
  [HTTP] &lt;-- POST /wd/hub/session 200 78056 ms - 941
  [HTTP] --&gt; POST /wd/hub/session/967301ea-6ced-4801-9f5a-e3d6b68c2e7f/timeouts {"type":"script","ms":11000}
  [MJSONWP] Driver proxy active, passing request on via HTTP proxy
  [debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/967301ea-6ced-4801-9f5a-e3d6b68c2e7f/timeouts] to [POST http://127.0.0.1:8000/wd/hub/session/98599620f036c57ea39d899794f9b5c0/timeouts] with body: {"type":"script","ms":11000}
  [debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"98599620f036c57ea39d899794f9b5c0","status":0,"value":null}
  [JSONWP Proxy] Replacing sessionId 98599620f036c57ea39d899794f9b5c0 with 967301ea-6ced-4801-9f5a-e3d6b68c2e7f
  [HTTP] &lt;-- POST /wd/hub/session/967301ea-6ced-4801-9f5a-e3d6b68c2e7f/timeouts 200 8 ms - 76
  [HTTP] --&gt; DELETE /wd/hub/session/967301ea-6ced-4801-9f5a-e3d6b68c2e7f {}
  [debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["967301ea-6ced-4801-9f5a-e3d6b68c2e7f"]
  [debug] [BaseDriver] Event 'quitSessionRequested' logged at 1503059101119 (09:25:01 GMT-0300 (Hora oficial do Brasil))
  [debug] [AndroidDriver] Shutting down Android driver
  [debug] [AndroidDriver] Stopping chromedriver for context WEBVIEW_br.com.bematech.staff
  [debug] [Chromedriver] Changed state to 'stopping'
  [debug] [JSONWP Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8000/wd/hub/session/98599620f036c57ea39d899794f9b5c0] with no body
  [debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"98599620f036c57ea39d899794f9b5c0\",\"status\":0,\"value\":null}"
  [debug] [Chromedriver] Changed state to 'stopped'
  [debug] [ADB] Getting connected devices...
  [debug] [ADB] 1 device(s) connected
  [debug] [ADB] Running 'C:\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.104.101:5555","shell","am","force-stop","br.com.bematech.staff"]
  [debug] [ADB] Pressing the HOME button
  [debug] [ADB] Getting connected devices...
  [debug] [ADB] 1 device(s) connected
  [debug] [ADB] Running 'C:\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","192.168.104.101:5555","shell","input","keyevent",3]
  [debug] [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}
  [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
  [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
  [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
  [debug] [AndroidBootstrap] Received command result from bootstrap
  [debug] [UiAutomator] Shutting down UiAutomator
  [debug] [UiAutomator] Moving to state 'stopping'
  [debug] [UiAutomator] UiAutomator shut down normally
  [debug] [UiAutomator] Moving to state 'stopped'
  [debug] [ADB] Attempting to kill all uiautomator processes
  </code></pre>
  
  <p>This is my folder structure:</p>
  
  <p>--tests
   conf.js
   spec.js</p>
  
  <p>conf.js</p>
  
  <pre><code> exports.config={
      seleniumAddress:'http://localhost:4723/wd/hub',
      specs:['spec.js'],
      capabilities: {
          platformName: 'android',
          platformVersion: '7.0',
          deviceName: 'Nexus',
          browserName: "",
          autoWebview: true,
  
          app: 'C:\\appium_drivers\\apks\\android-release.apk'
      },
      baseUrl: '127.0.0.1:4723',
  
      onPrepare: function () {
          let wd = require('wd'),
              protractor = require('protractor'),
              wdBridge = require('wd-bridge')(protractor,wd);
          wdBridge.initFromProtractor(exports.config);
      }
  };
  </code></pre>
  
  <p>spec.js</p>
  
  <pre><code>  describe('firstSpecStaff',function () {
  
            browserName = onPrepare('0.0.0.0', port);
            it('makelogin',function () {
            element(by.id('user')).sendKeys('admin@admin');
            element(by.id('password')).sendKeys('admin');
          });
   });
  </code></pre>