找不到模块'lodash'

时间:2014-04-25 06:25:09

标签: javascript node.js webstorm protractor

当我尝试在Webstorm中运行我的运行和调试设置时出现以下错误 -

> "C:\Program Files (x86)\JetBrains\WebStorm 8.0.1\bin\runnerw.exe"
> "C:\Program Files\nodejs\node.exe" node_modules\protractor\lib\cli.js
> C:\WebstormWorkspace\Protractor\config\protractorConfig.js
> 
> module.js:340
>     throw err;
>           ^ Error: Cannot find module 'lodash'
>     at Function.Module._resolveFilename (module.js:338:15)
>     at Function.Module._load (module.js:280:25)
>     at Module.require (module.js:364:17)
>     at require (module.js:380:17)
>     at Object.<anonymous> (C:\WebstormWorkspace\Protractor\node_modules\protractor\lib\configParser.js:4:9)
>     at Module._compile (module.js:456:26)
>     at Object.Module._extensions..js (module.js:474:10)
>     at Module.load (module.js:356:32)
>     at Function.Module._load (module.js:312:12)
>     at Module.require (module.js:364:17)
> 
> Process finished with exit code 8

我在全局安装了量角器,安装的包如下 -

C:\WebstormWorkspace\Protractor>npm install -g protractor
npm http GET https://registry.npmjs.org/protractor
npm http 304 https://registry.npmjs.org/protractor
npm http GET https://registry.npmjs.org/selenium-webdriver/2.41.0
npm http GET https://registry.npmjs.org/minijasminenode/0.4.0
npm http GET https://registry.npmjs.org/saucelabs
npm http GET https://registry.npmjs.org/adm-zip/0.4.4
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/q/1.0.0
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/adm-zip/0.4.4
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/selenium-webdriver/2.41.0
npm http 304 https://registry.npmjs.org/saucelabs
npm http 304 https://registry.npmjs.org/minijasminenode/0.4.0
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/q/1.0.0
npm http 304 https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/minimist
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/lru-cache
C:\Users\pjajoo\AppData\Roaming\npm\webdriver-manager -> C:\Users\pjajoo\AppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
C:\Users\pjajoo\AppData\Roaming\npm\protractor -> C:\Users\pjajoo\AppData\Roaming\npm\node_modules\protractor\bin\protractor
protractor@0.22.0 C:\Users\pjajoo\AppData\Roaming\npm\node_modules\protractor
├── saucelabs@0.1.1
├── q@1.0.0
├── minijasminenode@0.4.0
├── adm-zip@0.4.4
├── lodash@2.4.1
├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.8)
├── glob@3.2.9 (inherits@2.0.1, minimatch@0.2.14)
└── selenium-webdriver@2.41.0

C:\WebstormWorkspace\Protractor>

任何人都可以帮助我,为什么我无法在webstorm中运行它?

1 个答案:

答案 0 :(得分:2)

您已全局安装量角器,您必须将Webstorm运行配置中的脚本路径更改为全局脚本。