安装bcrypt,node-sass报错node-gyp rebuild解决方法

2018-03-02 11:31:40

npm install bcrypt,node-sass –save引起了让人很烦恼的错误,整个人心情都不好了。下边是个人的解决方法:

错误一

缺少python环境:

G:\nodejs\moviesite\node_modules\bcrypt>if not defined npm_config_node_gyp (node "D:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (rebuild) gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT HON env variable. gyp ERR! stack     at failNoPython (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:103:14) gyp ERR! stack     at D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:64:11 gyp ERR! stack     at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15) gyp ERR! System Windows_NT 6.3.9600 gyp ERR! command "node" "D:\\Program Files\\nodejs\\node_modules\\npm\\node_modu les\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd G:\nodejs\moviesite\node_modules\bcryptgyp ERR! node -v v0.12.2 gyp ERR! node-gyp -v v1.0.3 gyp ERR! not ok npm ERR! Windows_NT 6.3.9600 npm ERR! argv "D:\\Program Files\\nodejs\\\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bcrypt" "--save" npm ERR! node v0.12.2 npm ERR! npm  v2.7.4 npm ERR! code ELIFECYCLE npm ERR! bcrypt@0.8.3 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@0.8.3 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the bcrypt package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR!     node-gyp rebuild npm ERR! You can get their info via: npm ERR!     npm owner ls bcrypt npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR!     G:\nodejs\moviesite\npm-debug.log


安装python解决,python(v2.7 recommended, v3.x.x is not supported) 
下载:http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi

错误二

在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。 
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“VCBuild.exe”。要解决此问题, 
1) 安装 .NET Fram 
ework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到了 
其他位置,请将其位置添加到系统 
路径中。 [G:\nodejs\moviesite\node_modules\bcrypt\build\binding.sln] 
gyp ERR! build error

如图: 
这里写图片描述

需要安装Microsoft Visual Studio Express 2013 for Windows Desktop 
(版本应该不限制,我安装的是上边的版本)

安装成功,但是出现了警告,警告不影响bcrypt的使用 
这里写图片描述

  • 2017-01-19 01:05:32

    process对象

    process对象是Node的一个全局对象,提供当前Node进程的信息。它可以在脚本的任意位置使用,不必通过require命令加载。该对象部署了EventEmitter接口。

  • 2017-01-20 21:59:11

    WEBPACK DEV SERVER

    webpack-dev-server是一个小型的node.js Express服务器,它使用webpack-dev-middleware中间件来为通过webpack打包生成的资源文件提供Web服务。它还有一个通过Socket.IO连接着webpack-dev-server服务器的小型运行时程序。

  • 2017-01-21 10:32:29

    Vue-cli proxyTable 解决开发环境的跨域问题

    和后端联调时总是会面对恼人的跨域问题,最近基于Vue开发项目时也遇到了这个问题,两边各自想了一堆办法,查了一堆资料,加了一堆参数,最后还得我把自己的localhost映射成上线时将要使用的域名。

  • 2017-01-21 21:44:29

    详解 ESLint 规则,规范你的代码

    在很久之前就想通过工具来规范自己的代码风格,减少程序出错的概率,如果看过我的 一个前端程序猿的Sublime Text3的自我修养 ,这篇博客的朋友,肯定知道在当时我使用 SublimeLinter-jshint 插件来规范风格,但是实际上一直懒癌发作也没去看它的文档,使用着它默认的规则。不过现在是时候切换到 ESLint 了!

  • 2017-01-23 23:09:16

    使用 CSS3 实现超炫的 Loading(加载)动画效果

     SpinKit 是一套网页动画效果,包含8种基于 CSS3 实现的很炫的加载动画。借助 CSS3 Animation 的强大功能来创建平滑,易于定制的动画。SpinKit 的目标不是提供一个每个浏览器都兼容的解决方案,而是给现代浏览器提供更优的技术实现方案和更佳的使用体验。(为保证最佳的效果,请在 Chrome、Firefox 和 Safari 等现代浏览器中浏览)