错误:找不到模块'shrink-ray'

通过Yeoman使用惊人的angular度全堆生成器后 ,我按照设置说明,当我来运行npm startgulp serve我得到以下错误:

Error: Cannot find module 'shrink-ray'

看起来相当自我解释,所以我跑npm install shrink-ray ,这样做给了我以下错误:

 node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Releas e/zopfli-v1.4.0-node-v48-win32-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for node-zopfli@1.4.0 and node@6.9.2 ( node-v48 ABI) (falling back to source compile with node-gyp) Building the projects in this solution one at a time. To enable parallel build, pleas e add the "/m" switch. MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To f ix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2 005 or 3) add the location of the component to the system path if it is installed el sewhere. [C:\Users\alicia.sykes\Dropbox\Coding\Angular\team-awesome\node_modules\no de-zopfli\build\binding.sln] 

再次,这个错误看起来很明显,所以我按照它所build议的步骤 – 但它没有工作。 同样的错误总是返回,阻止我安装shrink-ray

经过了几个小时的谷歌search,看起来像是一个问题的组合:

  • node-gyp
  • 安装了NPM和节点版本
  • C ++构build工具(为什么,我不知道)
  • 让Python环境variables指向Python 2.7或3.1的正确安装位置

其中一些因素修改了错误信息 – 但没有一个是解决scheme。

解决scheme其实很简单:

(如admin / sudo)运行: npm install --global --production windows-build-tools

这是由这个GitHub问题上非常有帮助的Adonay28提供的,在这里: https : //github.com/angular-fullstack/generator-angular-fullstack/issues/2462#issuecomment-275112118

为了这个工作,你也需要有:

  • Python 2.7或3.1安装
  • 最新版本的npm( 4.5.0作品)。 运行: npm i npm -g更新。
  • 和全局安装node-gyp。 运行npm install -g node-gyp

希望这可以帮助别人,到那里应用程序运行得更快,谢谢我做到了!