【发布时间】:2018-07-20 11:59:44
【问题描述】:
我正在使用量角器 5.2.2。我有一个要求 - 将数据写入 excel 文件(我需要将动态变量传递给同一个 excel 文件。也就是说,当我每次运行时,应该将不同的数据集输入到 excel 中,所以我使用了编辑-xlsx)。我为此使用了以下代码。
var EditXlsx = require('edit-xlsx');
var xlsx = new EditXlsx('../files/exl.xlsx');
var sheet = xlsx.sheet(0);
var data = {
title: 'AKIRA'}
sheet.update('A1', 'Title');
但是当我运行量角器脚本时,它显示“错误:找不到模块 'edit-xlsx'”。当我通过命令 'npm install edit-xlsx' 安装了 edit-xlsx 时,它会给出错误并给出下面(我也成功安装了python 2.7)。
F:\frx-automation>npm install edit-xlsx
> libxmljs@0.9.0 install F:\frx-automation\node_modules\libxmljs
> node-gyp rebuild
F:\frx-automation\node_modules\libxmljs>if not defined npm_config_node_gyp (node
"C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-
bin\\..\..\node_modules\
node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files
(x86)\Python37-32\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program
Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd F:\frx-automation\node_modules\libxmljs
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN protractor-multiple-cucumber-html-reporter-plugin@1.7.0 requires a
peer of protractor@>= 4.0.0 but none is installed. You must install peer
dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents@
1.2.4: wanted {"os":"darwin","arch":"any"}
(current{"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! libxmljs@0.9.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libxmljs@0.9.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\CS1027C\AppData\Roaming\npm-cache\_logs\2018-
020T03_43_13_721Z-debug.log
我错了吗?提前谢谢
【问题讨论】:
-
所以,请显示错误。未安装此模块
edit-xlsx。您可以在node_modules文件夹中查看它 -
npm i edit-xlsx再试一次,可能是间歇性问题。我使用相同的命令并安装了软件包。如果您使用的是 vpn,请尝试使用您自己的代理连接。 -
我已经尝试过命令“npm i edit-xlsx”,但我没有使用 vpn。我仍然无法安装 npm i edit-xlsx。我在问题中添加了上述错误。
标签: protractor