Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

年终讲(7)———— window下全局安装bee-tools报错解决办法 #317

Open
lucian55 opened this issue Jan 15, 2019 · 1 comment

Comments

@lucian55
Copy link
Member

lucian55 commented Jan 15, 2019

写在前面

机器环境描述:

window10 64位
node版本:v10.13.0

问题描述

在组件库开发的时候,需要全局安装bee-tools,用window 电脑安装的时候报错,如下图:

image

从图中大概可以看出是因为 node-gyp这个包的问题

之后我还尝试了一下执行了 npm run dev ,报错如下:

image

这个图就比较明显了,意思大概是:node-sass不支持当前环境。

解决办法

1、 去 node-sass 下找到如下说明:意思大概是 环境需要依赖 node-gyp

Some users have reported issues installing on Ubuntu due to node being registered to another package. Follow the official NodeJS docs to install NodeJS so that #!/usr/bin/env node correctly resolves.
Compiling on Windows machines requires the node-gyp prerequisites.

2、 去 node-gyp 中找到如下:详情点击

image

意思大概是:node-gyp 安装环境需要有 python2.7和Visual C ++,gyp是一种根据c++源代码编译的工具,node-gyp就是为node编译c++扩展的时候使用的编译工具。
按照说明全局安装好 node-gyp 即可解决报错。

总结解决步骤

1、安装 python2.7 版本 和 Visual Studio Build Tools

2、全局安装 node-gyp

npm install -g node-gyp

3、配置依赖

npm config set python python2.7

npm config set msvs_version 2017

之后即可愉快的使用 bee-tools 了

@kvkens
Copy link
Member

kvkens commented Jan 21, 2019

最新版本的node安装windows版本安装提示会帮助自动安装此类依赖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants