第一次使用ionic2,安装的过程中就出现了问题,查看相关的问题,刚开始以为是python安装不正确,后来又以为是c ++ 环境没有配置好,折腾了好几个小时。我靠,基本都已经快要让我失去信心了,但是一不小心我发现了一个错误Cannot download “https://github.com/sass/node-sass/releases/download/3.13.1/win32-x64-46_binding.node”就是这个下载失败了,原来是sass环境搭建错误啊。搞得我浪费了那么多时间!先来看看错误提示吧。
ionic start myApp --v2
npm WARN prefer global node-gyp@3.6.0 should be installed with -g
> node-sass@3.13.1 install H:\Angular\bindo\node_modules\node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node":
connect ETIMEDOUT 52.216.80.48:443
Timed out whilst downloading the prebuilt binary
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
> node-sass@3.13.1 postinstall H:\Angular\bindo\node_modules\node-sass
> node scripts/build.js
Building: C:\Program Files\nodejs\node.exe H:\Angular\bindo\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 ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli 'H:\\Angular\\bindo\\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.0
gyp info using node@6.10.2 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python27" in the PATH
gyp verb `which` failed Error: not found: python27
gyp verb `which` failed at getNotFoundError (H:\Angular\bindo\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (H:\Angular\bindo\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (H:\Angular\bindo\node_modules\which\which.js:80:29)
gyp verb `which` failed at H:\Angular\bindo\node_modules\which\which.js:89:16
gyp verb `which` failed at H:\Angular\bindo\node_modules\isexe\index.js:42:5
gyp verb `which` failed at H:\Angular\bindo\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed python27 { Error: not found: python27
gyp verb `which` failed at getNotFoundError (H:\Angular\bindo\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (H:\Angular\bindo\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (H:\Angular\bindo\node_modules\which\which.js:80:29)
gyp verb `which` failed at H:\Angular\bindo\node_modules\which\which.js:89:16
gyp verb `which` failed at H:\Angular\bindo\node_modules\isexe\index.js:42:5
gyp verb `which` failed at H:\Angular\bindo\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:123:15) code: 'ENOENT' }
gyp verb could not find "python27". checking python launcher
gyp verb check python launcher python executable found: "C:\\Python27\\python.exe"
gyp verb check python version `C:\Python27\python.exe -c "import platform; print(platform.python_version());"` returned: "2.7.13\r\n"
gyp verb get node dir no --target version specified, falling back to host node version: 6.10.2
gyp verb command install [ '6.10.2' ]
gyp verb install input version string "6.10.2"
gyp verb install installing version: 6.10.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 6.10.2
gyp verb build dir attempting to create "build" dir: H:\Angular\bindo\node_modules\node-sass\build
gyp verb build dir "build" dir needed to be created? H:\Angular\bindo\node_modules\node-sass\build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: H:\Angular\bindo\node_modules\node-sass\build\config.gypi
gyp verb config.gypi checking for gypi file: H:\Angular\bindo\node_modules\node-sass\config.gypi
gyp verb common.gypi checking for gypi file: H:\Angular\bindo\node_modules\node-sass\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'H:\\Angular\\bindo\\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 'H:\\Angular\\bindo\\node_modules\\node-sass\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'H:\\Angular\\bindo\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\Administrator\\.node-gyp\\6.10.2\\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\\Administrator\\.node-gyp\\6.10.2',
gyp info spawn args '-Dnode_gyp_dir=H:\\Angular\\bindo\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=H:\\Angular\\bindo\\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 'H:\\Angular\\bindo\\node_modules\\node-sass\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\Administrator\.node-gyp\6.10.2
gyp verb found first Solution file build/binding.sln
gyp verb could not find "msbuild.exe" in PATH - finding location in registry
gyp verb "Release" dir needed to be created? null
gyp verb copying "node.lib" for x64 C:\Users\Administrator\.node-gyp\6.10.2\Release\node.lib
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
生成启动时间为 2017/4/11 3:14:07。
节点 1 上的项目“H:\Angular\bindo\node_modules\node-sass\build\binding.sln”(默认目标)。
ValidateSolutionConfiguration:
正在生成解决方案配置“Release|x64”。
项目“H:\Angular\bindo\node_modules\node-sass\build\binding.sln”(1)正在节点 1 上生成“H:\Angular\bindo\node_modules\node-sass\buil
d\binding.vcxproj.metaproj”(2) (默认目标)。
项目“H:\Angular\bindo\node_modules\node-sass\build\binding.vcxproj.metaproj”(2)正在节点 1 上生成“H:\Angular\bindo\node_modules\n
ode-sass\build\src\libsass.vcxproj”(3) (默认目标)。
H:\Angular\bindo\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: 未找到导入的项目“H:\Microsoft.Cpp.Defau
lt.props”。请确认
已完成生成项目“H:\Angular\bindo\node_modules\node-sass\build\src\libsass.vcxproj”(默认目标)的操作 - 失败。
已完成生成项目“H:\Angular\bindo\node_modules\node-sass\build\binding.vcxproj.metaproj”(默认目标)的操作 - 失败。
已完成生成项目“H:\Angular\bindo\node_modules\node-sass\build\binding.sln”(默认目标)的操作 - 失败。
生成失败。
“H:\Angular\bindo\node_modules\node-sass\build\binding.sln”(默认目标) (1) ->
“H:\Angular\bindo\node_modules\node-sass\build\binding.vcxproj.metaproj”(默认目标) (2) ->
“H:\Angular\bindo\node_modules\node-sass\build\src\libsass.vcxproj”(默认目标) (3) ->
H:\Angular\bindo\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: 未找到导入的项目“H:\Microsoft.Cpp.Def
ault.props”。请确认
0 个警告
1 个错误
已用时间 00:00:00.66
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (H:\Angular\bindo\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:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "H:\\Angular\\bindo\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd H:\Angular\bindo\node_modules\node-sass
gyp ERR! node -v v6.10.2
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN ionic-project@1.1.1 No repository field.
npm WARN ionic-project@1.1.1 No license field.
npm WARN Error: EPERM: operation not permitted, scandir 'H:\Angular\bindo\node_modules\cross-spawn\node_modules'
npm WARN at Error (native)
npm WARN { Error: EPERM: operation not permitted, scandir 'H:\Angular\bindo\node_modules\cross-spawn\node_modules'
npm WARN at Error (native)
npm WARN errno: -4048,
npm WARN code: 'EPERM',
npm WARN syscall: 'scandir',
npm WARN path: 'H:\\Angular\\bindo\\node_modules\\cross-spawn\\node_modules' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.13.1 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.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2017-04-10T19_14_14_920Z-debug.log
解决的办法也很简单哦。
直接用迅雷下载https://github.com/sass/node-sass/releases/download/3.13.1/win32-x64-46_binding.node,然后设置环境变量。
变量名称:SASS_BINARY_PATH,变量值:c:\ccc\win32-x64-46_binding.node,这样就可以了。基本就解决了问题了!