node-sass安装失败完美解决方法
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                node-sass安装失败完美解决方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                一、介紹
首先很感謝node-sass安裝失敗的各種坑這篇教程,給我提供了解決問題的各種方法,但是天不遂人愿,我的情況可能比較特殊,node-sass還是安裝不上,下面說下我遇到的情況和解決的方法。
二、問題
gyp錯誤沒有安裝我也就忍了,你給我提示個xxx python27 xxx是什么意思?難道nodejs都已經需要python來支持了?什么破錯誤提示,又長又難看!!這里我不得不吐槽下,浪費了我兩天的時間好嘛!,大家不要被它騙了,當然如果你通過上面的鏈接成功解決了那不算。解決方法在最下面,你也需要看一遍這又長又難看的錯誤提示,來來一起吐槽吧。
> node-sass@3.13.1 install E:\web_hwf\Vue\02app\node_modules\node-sass> node scripts/install.js Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-64_binding.node Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-64_binding.node": HTTP error 404 Not Found Hint: If github.com is not accessible in your locationtry setting a proxy via HTTP_PROXY, e.g.export HTTP_PROXY=http://example.com:1234 or configure npm proxy vianpm config set proxy http://example.com:8080 > node-sass@3.13.1 postinstall E:\web_hwf\Vue\02app\node_modules\node-sass > node scripts/build.js Building: E:\26_nodejs\node.exe E:\web_hwf\Vue\02app\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 [ 'E:\\26_nodejs\\node.exe', gyp verb cli 'E:\\web_hwf\\Vue\\02app\\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.2 gyp info using node@10.1.0 | 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 "C:\Python27\python.exe" in the PATH gyp verb `which` succeeded C:\Python27\python.exe C:\Python27\python.exe gyp verb check python version `C:\Python27\python.exe -c "import platform; print(platform.python_version());"` returned: "2.7.14\r\n" gyp verb get node dir no --target version specified, falling back to host node version: 10.1.0 gyp verb command install [ '10.1.0' ] gyp verb install input version string "10.1.0" gyp verb install installing version: 10.1.0 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: 10.1.0 gyp verb build dir attempting to create "build" dir: E:\web_hwf\Vue\02app\node_modules\node-sass\build gyp verb build dir "build" dir needed to be created? E:\web_hwf\Vue\02app\node_modules\node-sass\build gyp verb build/config.gypi creating config file gyp verb build/config.gypi writing out config file: E:\web_hwf\Vue\02app\node_modules\node-sass\build\config.gypi gyp verb config.gypi checking for gypi file: E:\web_hwf\Vue\02app\node_modules\node-sass\config.gypi gyp verb common.gypi checking for gypi file: E:\web_hwf\Vue\02app\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 [ 'E:\\web_hwf\\Vue\\02app\\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 'E:\\web_hwf\\Vue\\02app\\node_modules\\node-sass\\build\\config.gypi', gyp info spawn args '-I', gyp info spawn args 'E:\\web_hwf\\Vue\\02app\\node_modules\\node-gyp\\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\\Users\\Administrator\\.node-gyp\\10.1.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\\Administrator\\.node-gyp\\10.1.0', gyp info spawn args '-Dnode_gyp_dir=E:\\web_hwf\\Vue\\02app\\node_modules\\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\\Users\\Administrator\\.node-gyp\\10.1.0\\<(target_arch)\\node.lib', gyp info spawn args '-Dmodule_root_dir=E:\\web_hwf\\Vue\\02app\\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:\\web_hwf\\Vue\\02app\\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\10.1.0 gyp verb found first Solution file build/binding.sln gyp verb could not find "msbuild.exe" in PATH - finding location in registry gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe gyp info spawn args [ 'build/binding.sln', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' ] Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. Build started 2018/6/6 15:52:53. Project "E:\web_hwf\Vue\02app\node_modules\node-sass\build\binding.sln" on node 1 (default targets). ValidateSolutionConfiguration:Building solution configuration "Release|x64". Project "E:\web_hwf\Vue\02app\node_modules\node-sass\build\binding.sln" (1) is building "E:\web_hwf\Vue\02app\node_modules\node-sass\build\binding.vcxproj.metaproj" (2) on node 1 (default targets). Project "E:\web_hwf\Vue\02app\node_modules\node-sass\build\binding.vcxproj.metaproj" (2) is building "E:\web_hwf\Vue\02app\node_modules\node-sass\build\src\libsass.vcxproj" (3) on node 1 (default targets). E:\web_hwf\Vue\02app\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: The imported project "E:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. Done Building Project "E:\web_hwf\Vue\02app\node_modules\node-sass\build\src\libsass.vcxproj" (default targets) -- FAILED. Done Building Project "E:\web_hwf\Vue\02app\node_modules\node-sass\build\binding.vcxproj.metaproj" (default targets) -- FAILED. Done Building Project "E:\web_hwf\Vue\02app\node_modules\node-sass\build\binding.sln" (default targets) -- FAILED. Build FAILED. "E:\web_hwf\Vue\02app\node_modules\node-sass\build\binding.sln" (default target) (1) -> "E:\web_hwf\Vue\02app\node_modules\node-sass\build\binding.vcxproj.metaproj" (default target) (2) -> "E:\web_hwf\Vue\02app\node_modules\node-sass\build\src\libsass.vcxproj" (default target) (3) ->E:\web_hwf\Vue\02app\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: The imported project "E:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.0 Warning(s)1 Error(s) Time Elapsed 00:00:00.07 gyp ERR! build error gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (E:\web_hwf\Vue\02app\node_modules\node-gyp\lib\build.js:258:23) gyp ERR! stack at ChildProcess.emit (events.js:182:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "E:\\26_nodejs\\node.exe" "E:\\web_hwf\\Vue\\02app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd E:\web_hwf\Vue\02app\node_modules\node-sass gyp ERR! node -v v10.1.0 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok Build failed with error code: 1 npm WARN rollback Rolling back source-map@0.4.4 failed (this is probably harmless): EPERM: operation not permitted, lstat 'E:\web_hwf\Vue\02app\node_modules\scss-tokenizer\node_modules' npm WARN eslint-config-standard@6.2.1 requires a peer of eslint-plugin-promise@>=3.3.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) 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. npm ERR! This is probably not a problem with npm. 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\2018-06-06T07_52_55_703Z-debug.log三、解決方法
把nodejs卸載干凈,一定要干凈,可百度。
重新安裝nodejs,然后執行npm audit fix
再執行npm audit fix --force
最后祝你完美解決這個問題,如果還是不行,我只能說抱歉了xiongdei,只能靠你自己了,加油!!
總結
以上是生活随笔為你收集整理的node-sass安装失败完美解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: Docker学习笔记1 :镜像制作
 - 下一篇: 第十二章UML与Rational Ros