node-sass 安装报错解决办法

来源:互联网 发布:韩雪网络直播视频 编辑:程序博客网 时间:2024/05/16 04:59

错误截图

E:\kibana>npm install node-sass> node-sass@3.8.0 install E:\kibana\node_modules\node-sass> node scripts/install.jsCannot download "https://github.com/sass/node-sass/releases/download/v3.8.0/win32-x64-48_binding.node":tunneling socket could not be established, cause=socket hang upHint: If github.com is not accessible in your location      try setting a proxy via HTTP_PROXY, e.g.      export HTTP_PROXY=http://example.com:1234or configure npm proxy via      npm config set proxy http://example.com:8080> node-sass@3.8.0 postinstall E:\kibana\node_modules\node-sass> node scripts/build.jsBuilding: D:\Program Files\nodejs\node.exe E:\kibana\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=gyp info it worked if it ends with okgyp verb cli [ 'D:\\Program Files\\nodejs\\node.exe',gyp verb cli   'E:\\kibana\\node_modules\\node-gyp\\bin\\node-gyp.js',gyp verb cli   'rebuild',gyp verb cli   '--verbose',gyp verb cli   '--libsass_ext=',gyp verb cli   '--libsass_cflags=',gyp verb cli   '--libsass_ldflags=',gyp verb cli   '--libsass_library=' ]gyp info using node-gyp@3.6.0gyp info using node@6.2.0 | win32 | x64gyp verb command rebuild []gyp verb command clean []gyp verb clean removing "build" directorygyp verb command configure []gyp verb check python checking for Python executable "python2" in the PATHgyp verb `which` failed Error: not found: python2gyp verb `which` failed     at getNotFoundError (E:\kibana\node_modules\which\which.js:13:12)gyp verb `which` failed     at F (E:\kibana\node_modules\which\which.js:68:19)gyp verb `which` failed     at E (E:\kibana\node_modules\which\which.js:80:29)gyp verb `which` failed     at E:\kibana\node_modules\which\which.js:89:16gyp verb `which` failed     at E:\kibana\node_modules\isexe\index.js:42:5gyp verb `which` failed     at E:\kibana\node_modules\isexe\windows.js:36:5gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:117:15)gyp verb `which` failed  python2 { Error: not found: python2gyp verb `which` failed     at getNotFoundError (E:\kibana\node_modules\which\which.js:13:12)gyp verb `which` failed     at F (E:\kibana\node_modules\which\which.js:68:19)gyp verb `which` failed     at E (E:\kibana\node_modules\which\which.js:80:29)gyp verb `which` failed     at E:\kibana\node_modules\which\which.js:89:16gyp verb `which` failed     at E:\kibana\node_modules\isexe\index.js:42:5gyp verb `which` failed     at E:\kibana\node_modules\isexe\windows.js:36:5gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:117:15) code: 'ENOENT' }gyp verb check python checking for Python executable "python" in the PATHgyp verb `which` succeeded python C:\Python27\python.EXEgyp verb check python version `C:\Python27\python.EXE -c "import platform; print(platform.python_version());"` returned: "2.7.12\r\n"gyp verb get node dir no --target version specified, falling back to host node version: 6.2.0gyp verb command install [ '6.2.0' ]gyp verb install input version string "6.2.0"gyp verb install installing version: 6.2.0gyp verb install --ensure was passed, so won't reinstall if already installedgyp verb install version is already installed, need to check "installVersion"gyp verb got "installVersion" 9gyp verb needs "installVersion" 9gyp verb install version is goodgyp verb get node dir target node version installed: 6.2.0gyp verb build dir attempting to create "build" dir: E:\kibana\node_modules\node-sass\buildgyp verb build dir "build" dir needed to be created? E:\kibana\node_modules\node-sass\buildgyp verb Not using VS2017: Could not use PowerShell to find VS2017gyp verb build/config.gypi creating config filegyp verb build/config.gypi writing out config file: E:\kibana\node_modules\node-sass\build\config.gypigyp verb config.gypi checking for gypi file: E:\kibana\node_modules\node-sass\config.gypigyp verb common.gypi checking for gypi file: E:\kibana\node_modules\node-sass\common.gypigyp verb gyp gyp format was not specified; forcing "msvs"gyp info spawn C:\Python27\python.EXEgyp info spawn args [ 'E:\\kibana\\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=auto',gyp info spawn args   '-I',gyp info spawn args   'E:\\kibana\\node_modules\\node-sass\\build\\config.gypi',gyp info spawn args   '-I',gyp info spawn args   'E:\\kibana\\node_modules\\node-gyp\\addon.gypi',gyp info spawn args   '-I',gyp info spawn args   'C:\\Users\\15061857\\.node-gyp\\6.2.0\\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\\15061857\\.node-gyp\\6.2.0',gyp info spawn args   '-Dnode_gyp_dir=E:\\kibana\\node_modules\\node-gyp',gyp info spawn args   '-Dnode_lib_file=node.lib',gyp info spawn args   '-Dmodule_root_dir=E:\\kibana\\node_modules\\node-sass',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   'E:\\kibana\\node_modules\\node-sass\\build',gyp info spawn args   '-Goutput_dir=.' ]gyp verb command build []gyp verb build type Releasegyp verb architecture x64gyp verb node dev dir C:\Users\15061857\.node-gyp\6.2.0gyp verb found first Solution file build/binding.slngyp verb could not find "msbuild.exe" in PATH - finding location in registrygyp verb "Release" dir needed to be created? nullgyp verb copying "node.lib" for x64 C:\Users\15061857\.node-gyp\6.2.0\Release\node.libgyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exegyp info spawn args [ 'build/binding.sln',gyp info spawn args   '/nologo',gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]Build started 2017/4/15 11:57:06.Project "E:\kibana\node_modules\node-sass\build\binding.sln" on node 1 (default targets).ValidateSolutionConfiguration:  Building solution configuration "Release|x64".MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 [E:\kibana\node_modules\node-sass\build\binding.sln]Done Building Project "E:\kibana\node_modules\node-sass\build\binding.sln" (default targets) -- FAILED.Build FAILED."E:\kibana\node_modules\node-sass\build\binding.sln" (default target) (1) ->(_src_\libsass target) ->  MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 [E:\kibana\node_modules\node-sass\build\binding.sln]    0 Warning(s)    1 Error(s)Time Elapsed 00:00:00.23gyp ERR! build errorgyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1gyp ERR! stack     at ChildProcess.onExit (E:\kibana\node_modules\node-gyp\lib\build.js:285:23)gyp ERR! stack     at emitTwo (events.js:106:13)gyp ERR! stack     at ChildProcess.emit (events.js:191:7)gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)gyp ERR! System Windows_NT 6.1.7601gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "E:\\kibana\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="gyp ERR! cwd E:\kibana\node_modules\node-sassgyp ERR! node -v v6.2.0gyp ERR! node-gyp -v v3.6.0gyp ERR! not okBuild failednpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\babel-cli\node_modules\chokidar\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})npm WARN grunt-angular-translate@0.3.0 requires a peer of grunt@~0.4.0 but nonewas installed.npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! node-sass@3.8.0 postinstall: `node scripts/build.js`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the node-sass@3.8.0 postinstall script 'node scripts/build.js'.npm ERR! Make sure you have the latest version of node.js and npm installed.npm ERR! If you do, this is most likely a problem with the node-sass package,npm ERR! not with npm itself.npm ERR! Tell the author that this fails on your system:npm ERR!     node scripts/build.jsnpm ERR! You can get information on how to open an issue for this project with:npm ERR!     npm bugs node-sassnpm ERR! Or if that isn't available, you can get their info via:npm ERR!     npm owner ls node-sassnpm ERR! There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\15061857\AppData\Roaming\npm-cache\_logs\2017-04-15T03_57_07_545Z-debug.log

解决办法:
主要是windows平台缺少编译环境,
1、先运行: npm install -g node-gyp
2、然后运行:运行 npm install –global –production windows-build-tools 可以自动安装跨平台的编译器:gym

gym官网:https://www.npmjs.com/package/node-gyp
解决办法:http://blog.csdn.net/notejs/article/details/49681649

1 0