Npm gyp安装karma时出错

Npm gyp安装karma时出错,npm,karma-runner,Npm,Karma Runner,第一次问问题,如果我把事情搞砸了,对不起。 我正在尝试安装karma,我更喜欢本地安装,但无法在全球或本地安装。奇怪的是,karma和karma cli似乎已安装,但无论我如何尝试,它们都不会运行 C:\Users\rdana\AppData\Roaming\npm\node_modules\karma\node_modules\ socket.io\node_modules\socket.io-client\node_modules\engine.io- client\node_modul

第一次问问题,如果我把事情搞砸了,对不起。 我正在尝试安装karma,我更喜欢本地安装,但无法在全球或本地安装。奇怪的是,karma和karma cli似乎已安装,但无论我如何尝试,它们都不会运行

 C:\Users\rdana\AppData\Roaming\npm\node_modules\karma\node_modules\
socket.io\node_modules\socket.io-client\node_modules\engine.io- 
client\node_modules\ws\node_modules\bufferutil>
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 )
 Building the projects in this solution one at a time. 
To enable parallel build, please add the "/m" switch.

  C:\Users\rdana\AppData\Roaming\npm\node_modules\karma\
  node_modules\socket.io\node_modules\socket.io-        
 client\node_modules\engine.io-  
  client\node_modules\ws\node_modules\bufferutil\build\bufferutil.vcxproj(20,3):
  error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was 
  not found. Confirm that the path in the <Import> declaration is correct,and that the file   exists on disk.
  gyp ERR! build error
  gyp ERR! stack Error: 
  `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
 gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm
\\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\rdana\AppData\Roaming\npm\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.2.1
npm WARN optional dep failed, continuing bufferutil@1.2.1
C:\Users\rdana\AppData\Roaming\npm\node\u modules\karma\node\u modules\
socket.io\node\u modules\socket.io客户端\node\u modules\engine.io-
client\node\u modules\ws\node\u modules\bufferutil>
如果未定义npm\U配置\U节点\U gyp
(节点“C:\Program Files\nodejs\node\U modules\npm\bin\node gyp bin\\\\\\\\\\\\\\\\\\\\\ node\U modules\node gyp\bin\node gyp.js”重建)
else(节点重建)
在此解决方案中一次构建一个项目。
要启用并行生成,请添加“/m”开关。
C:\Users\rdana\AppData\Roaming\npm\node\u modules\karma\
node\u modules\socket.io\node\u modules\socket.io-
client\node\u modules\engine.io-
client\node\u modules\ws\node\u modules\bufferutil\build\bufferutil.vcxproj(20,3):
错误MSB4019:导入的项目“C:\Microsoft.Cpp.Default.props”已被删除
没有找到。确认声明中的路径正确,并且文件存在于磁盘上。
哎呀!构建错误
哎呀!堆栈错误:
`C:\Program Files(x86)\MSBuild\12.0\bin\MSBuild.exe`失败,退出代码:1
哎呀!堆栈位于ChildProcess.onExit(C:\Program Files\nodejs\node\u modules\npm\node\u modules\node gyp\lib\build.js:270:23)
哎呀!在emitTwo处堆栈(events.js:87:13)
哎呀!ChildProcess.emit处的堆栈(events.js:172:7)
哎呀!在Process.ChildProcess.\u handle.onexit(internal/child\u Process.js:200:12)处堆栈
哎呀!系统Windows\u NT 6.1.7601
哎呀!命令“C:\\Program Files\\nodejs\\node.exe”C:\\Program Files\\nodejs\\node\u modules\\npm
\\\node_modules\\node gyp\\bin\\node gyp.js“重建”
哎呀!cwd C:\Users\rdana\AppData\Roaming\npm\node_modules\karma\node_modules\socket.io\node_modules\socket.io客户端\node_modules\engine.io客户端\node_modules\ws\node_modules\bufferutil
哎呀!节点-v4.2.2
哎呀!节点gyp-v3.0.3
哎呀!不好
npm警告可选dep失败,继续utf-8-validate@1.2.1
npm警告可选dep失败,继续bufferutil@1.2.1
我曾就这个错误咨询过其他帖子

我试过“npm安装-g karma--msvs_version=2013”

我的机器上有Visual Studio 2012,还有Python 2.7.3。我已经卸载并重新安装了node gyp。我还没有弄乱过任何Windows SDK、VS SP1和VC++编译器的东西,因为这是一台工作机器,我没有本地管理员权限下载软件。 在这一点上,我有点被卡住了。任何帮助都将不胜感激

如前所述,我还为karma安装了CLI工具。我已将npm/节点添加到我的路径中。也许karma不会运行的原因是我在一些帖子中看到了一些可执行文件的问题,但我想我会先在这里发布,因为安装问题


再次提前感谢

通过一些帮助解决了这个问题,结果发现这是一个路径问题。可能与我的机器和一些配置设置隔离。谢谢有一个类似的问题,路径问题和解决方案是什么?@GraehamF-hey,结果是可执行文件没有添加到我的路径中。我仍然不确定是否是因为路径膨胀,仍然无法在我的cmd提示符中运行karma。我在cmd提示符下运行powershell,然后在那里运行karma。我通过将业力添加到我的powershell路径中解决了这个问题,在“业力开始”中手动映射。评论太长,添加另一个one@GraehamF查看此链接可向powershell路径添加内容此链接可映射可执行文件祝您好运!通过一些帮助解决了这个问题,结果发现这是一个路径问题。可能与我的机器和一些配置设置隔离。谢谢有一个类似的问题,路径问题和解决方案是什么?@GraehamF-hey,结果是可执行文件没有添加到我的路径中。我仍然不确定是否是因为路径膨胀,仍然无法在我的cmd提示符中运行karma。我在cmd提示符下运行powershell,然后在那里运行karma。我通过将业力添加到我的powershell路径中解决了这个问题,在“业力开始”中手动映射。评论太长,添加另一个one@GraehamF查看此链接可向powershell路径添加内容此链接可映射可执行文件祝您好运!