问题
Trying to install Protractor 2.0.0, I'm facing the following problem:
$ npm install -g protractor
npm http GET https://registry.npmjs.org/protractor
npm http 304 https://registry.npmjs.org/protractor
...
npm http 200 https://registry.npmjs.org/nan
> utf-8-validate@1.0.1 install C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild
C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate {git}
{lamb} node "d:\Developpement\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack at errnoException (child_process.js:998:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:34)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "d:\\Developpement\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.0.1
> bufferutil@1.0.1 install C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild
C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\bufferutil {git}
{lamb} node "d:\Developpement\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack at errnoException (child_process.js:998:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:34)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "d:\\Developpement\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm WARN optional dep failed, continuing bufferutil@1.0.1
C:\Users\clouderial\AppData\Roaming\npm\protractor -> C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor\bin\protractor
C:\Users\clouderial\AppData\Roaming\npm\webdriver-manager -> C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor\bin\webdriver-manager
npm WARN unmet dependency C:\Users\clouderial\AppData\Roaming\npm\node_modules\jmcnet\node_modules\grunt-contrib-watch requires lodash@'~2.4.1' but will load
npm WARN unmet dependency C:\Users\clouderial\AppData\Roaming\npm\node_modules\jmcnet\node_modules\lodash,
npm WARN unmet dependency which is version 3.5.0
protractor@2.0.0 C:\Users\clouderial\AppData\Roaming\npm\node_modules\protractor
├── jasminewd@1.1.0
├── jasminewd2@0.0.3
├── html-entities@1.1.2
├── saucelabs@0.1.1
├── q@1.0.0
├── minijasminenode@1.1.1
├── adm-zip@0.4.4
├── lodash@2.4.1
├── accessibility-developer-tools@2.6.0
├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.10)
├── glob@3.2.11 (inherits@2.0.1, minimatch@0.3.0)
├── request@2.36.0 (forever-agent@0.5.2, qs@0.6.6, json-stringify-safe@5.0.0, tunnel-agent@0.4.0, aws-sign2@0.5.0, oauth-sign@0.3.0, mime@1.2.11, node-uuid@1.4.3, tough-cookie@0.12.1, http-signature@0.10.1, hawk@1.0.0, form-data@0.1.4)
├── jasmine@2.1.1 (jasmine-core@2.1.3)
├── source-map-support@0.2.10 (source-map@0.1.32)
└── selenium-webdriver@2.45.1 (tmp@0.0.24, rimraf@2.3.2, ws@0.7.1, xml2js@0.4.4)
I'm under Windows8 and I had to install Python (3.4.3) to achieve this installation.
My E2E tests are broken after this installation. Any help would be greatly appreciated.
Jean-Marc
回答1:
There was 2 problems : 1. Python 2.7.x must be installed instead of Python 3.x, 2. An environment variable named PYTHON valued to path+python.exe must be set before running npm.
After this change the installation can continu (but is blocked here : Installation of Protractor 2.0 and MSBUILD error MSB3428)
Jean-Marc.
来源:https://stackoverflow.com/questions/29197828/cannot-install-protractor-2-0-0-enoent-in-bufferutil-while-node-gyp-rebuild