nodejs安装sharp出错的问题

PS D:
eportsourcelpd-planning-allocation> yarn
yarn install v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.2: The platform "win32" is incompatible with this module.
info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/2] ⠄ dtrace-provider
[2/2] ⠄ sharp: C:Userschenwes.node-gyp8.9.4x64
ode.lib : fatal error LNK1127: ������ [D:
eportesquellpd-planning-allocation
ode_modulessharpuildsharp.vcxproj]
[-/2] ⠄ waiting...
[-/2] ⠄ waiting...
error D:
eportsourcelpd-planning-allocation
ode_modulessharp: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: D:
eportesquellpd-planning-allocation
ode_modulessharp
Output:
D:
eportsourcelpd-planning-allocation
ode_modulessharp>if not defined npm_config_node_gyp (node "C:Program Files
odejs
ode_modules
pmin
ode-gyp-bin\....
ode_modules
ode-gypin
ode-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.9.4 | win32 | x64
gyp info spawn C:Python27python.EXE
gyp info spawn args [ 'C:\Users\chenwes\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'D:\report\esquel\lpd-planning-allocation\node_modules\sharp\build\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\Users\chenwes\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\Users\chenwes\.node-gyp\8.9.4\include\node\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\Users\chenwes\.node-gyp\8.9.4',
gyp info spawn args   '-Dnode_gyp_dir=C:\Users\chenwes\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\Users\chenwes\.node-gyp\8.9.4\<(target_arch)\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\report\esquel\lpd-planning-allocation\node_modules\sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\report\esquel\lpd-planning-allocation\node_modules\sharp\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuild15.0BinMSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
�ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ�����ӡ�/m�����ء�
  VError.cpp
  VInterpolate.cpp
  VImage.cpp
  win_delay_load_hook.cc
    ���ڴ����� D:
eportesquellpd-planning-allocation
ode_modulessharpuildReleaselibvips-cpp.lib �Ͷ��� D:
eportesquellpd-planning-allocation
ode_modulessharpuildReleaselibvips-cpp.exp
  �������ɴ���
  ����ɴ��������
  libvips-cpp.vcxproj -> D:
eportesquellpd-planning-allocation
ode_modulessharpuildRelease\libvips-cpp.dll
  common.cc
  metadata.cc
  operations.cc
  pipeline.cc
  sharp.cc
  utilities.cc
  win_delay_load_hook.cc
C:Userschenwes.node-gyp8.9.4x64
ode.lib : fatal error LNK1127: ������ [D:
eportesquellpd-planning-allocation
ode_modulessharpuildsharp.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuild15.0BinMSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:UserschenwesAppDataRoaming
vmv8.9.4
ode_modules
pm
ode_modules
ode-gyplibuild.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
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 D:
eportsourcelpd-planning-allocation
ode_modulessharp

--python switch to point to Python >= v2.5.0 & < 3.0.0.

python版本有要求

yarn config set python C:Python27python.exe

装了2.7  设置一下  就可以了

 

 

原文地址:https://www.cnblogs.com/weschen/p/9003024.html