目录

关于 windows 下 node_modules ode-sass endor 的报错解决方法

目录

项目 git clone 下来之后,运行 npminstall, npm start 报错代码如下:

1
2
ERROR in ENOENT: no such file or directory, scandir 'E:\React\helloworld\node_modules\node-sass\vendor'
 @ ./src/layouts/CoreLayout/CoreLayout.scss 4:14-284 13:2-17:4 14:20-290

其原因是 windows 下的 node-sass 编译没通过,需要下载微软的编译环境及工具,但也有直接解决方案:

方案一、

  • 创建目录 E:\React\helloworld\node_modules\node-sass\vendor
  • 再次运行 npm start,查看报错如下
1
2
ERROR in Missing binding E:\React\react-redux-starter-kit-go\node_modules\node-sass\vendor\win32-x64-47\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 5.x
  • 去https://github.com/sass/node-sass/releases下载对应版本的node-sass的binding.node,比如我这里就要下载
1
win32-x64-47_binding.pdb
  • 将该文件改名放到 E:\React\react-redux-starter-kit-go\node_modules\node-sass\vendor\win32-x64-47\binding.node

方案二、

  • 使用https://npm.taobao.org 阿里的镜像安装

npm 方式:

1
2
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install

yarn 方式:

1
2
npm install -g tyarn --registry=https://registry.npm.taobao.org
tyarn