Windows 10上出现奇怪的NPM错误

时间:2018-01-07 06:02:10

标签: node.js windows npm windows-10 build-tools

在设置了库存#!/usr/bin/perl open(SOURCE,"</home/amp/surevy01/file1"); open(DESTINATION,"</home/amp/surevy01/file2"); while(my $line = <SOURCE>) { while(my $line1 = <DESTINATION>) { #chomp($line); #chomp($line1); if ($line =~ "host") { #my $count = grep {host} $line; #my $count = `sed -i {s/host/host\n/g} $line1 | grep -c {host}`; #my $count = `perl -pi -e 's/host/host\n/g' $line1 | grep -c host`; #my $count grep ("host" ,$line); print "$count"; print "match found \n"; next; } else { print "match not found \n"; exit; } } } 后,开始切换到打字稿,我去了react-native我得到了

yarn install

相关错误似乎是:

> yarn install v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "win32" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility 

check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > babel-jest@22.0.4" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0".
[4/4] Building fresh packages...
[1/1] ⢀ weak: Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
[-/1] ⢀ waiting...
[-/1] ⢀ waiting...
[-/1] ⢀ waiting...
warning Error running install script for optional dependency: "C:\\Users\\me\\projects\\mycrate\\node_modules\\weak: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments: \nDirectory: C:\\Users\\me\\projects\\mycrate\\node_modules\\weak\nOutput:\nC:\\Users\\me\\projects\\mycrate\\node_modules\\weak>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 ) \r\ngyp info it worked if it ends with ok\ngyp info using node-gyp@3.6.2\ngyp info using node@9.3.0 | win32 | x64\ngyp info spawn C:\\Python27\\python.EXE\ngyp info spawn args [ 'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\gyp\\\\gyp_main.py',\ngyp info spawn args   'binding.gyp',\ngyp info spawn args   '-f',\ngyp info spawn args   'msvs',\ngyp info spawn args   '-G',\ngyp info spawn args   'msvs_version=auto',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\me\\\\projects\\\\mycrate\\\\node_modules\\\\weak\\\\build\\\\config.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\addon.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\me\\\\.node-gyp\\\\9.3.0\\\\include\\\\node\\\\common.gypi',\ngyp info spawn args   '-Dlibrary=shared_library',\ngyp info spawn args   '-Dvisibility=default',\ngyp info spawn args   '-Dnode_root_dir=C:\\\\Users\\\\me\\\\.node-gyp\\\\9.3.0',\ngyp info spawn args   '-Dnode_gyp_dir=C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp',\ngyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\me\\\\.node-gyp\\\\9.3.0\\\\<(target_arch)\\\\node.lib',\ngyp info spawn args   '-Dmodule_root_dir=C:\\\\Users\\\\me\\\\projects\\\\mycrate\\\\node_modules\\\\weak',\ngyp info spawn args   '-Dnode_engine=v8',\ngyp info spawn args   '--depth=.',\ngyp info spawn args   '--no-parallel',\ngyp info spawn args   '--generator-output',\ngyp info spawn args   'C:\\\\Users\\\\me\\\\projects\\\\mycrate\\\\node_modules\\\\weak\\\\build',\ngyp info spawn args   '-Goutput_dir=.' ]\ngyp info spawn C:\\Program Files (x86)\\MSBuild\\14.0\\bin\\msbuild.exe\ngyp info spawn args [ 'build/binding.sln',\ngyp info spawn args   '/clp:Verbosity=minimal',\ngyp info spawn args   '/nologo',\ngyp info spawn args   '/p:Configuration=Release;Platform=x64' ]\nBuilding the projects in this solution one at a time. To enable parallel build, please add the \"/m\" switch.\r\nMSBUILD : error MSB4132: The tools version \"2.0\" is unrecognized. Available tools versions are \"12.0\", \"14.0\", \"4.0\".\r\ngyp ERR! build error \ngyp ERR! stack Error: `C:\\Program Files (x86)\\MSBuild\\14.0\\bin\\msbuild.exe` failed with exit code: 1\ngyp ERR! stack     at ChildProcess.onExit (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\build.js:258:23)\ngyp ERR!Done in 7.68s.

在此之后,我尝试了一些东西:

  • 安装独立构建工具
  • 在管理外壳中试图error MSB4132: The tools version \"2.0\" is unrecognized. Available tools versions are \"12.0\", \"14.0\", \"4.0\".\r\ngyp ERR! build error \ngyp ERR! stack Error: npm install windows-build-tools个包
  • 尝试使用npm install --production windows-build-tools --global设置要在npm中使用的msvc版本。 npm config set msvs_version 201x --globalx35的位置。

这些都没有奏效。

我不知道该做什么,“只是使用mac或linux机器”目前不是一种选择。

编辑:

我的包依赖项是:

7

再次编辑:

我忘了提到我关闭并重新打开每一步的命令行。

1 个答案:

答案 0 :(得分:0)

这可能是您正在使用的npm版本的错误。

见这个帖子:

https://github.com/npm/npm/issues/18380

尝试将您的npm版本回滚到5.3

这个问题似乎是带有babel软件包的Windows独有的。