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

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

ERROR in ENOENT: no such file or directory, scandir 'E:Reacthelloworld
ode_modules
ode-sassvendor'
 @ ./src/layouts/CoreLayout/CoreLayout.scss 4:14-284 13:2-17:4 14:20-290

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

方案一、

  • 创建目录E:Reacthelloworld ode_modules ode-sassvendor
  • 再次运行npm start,查看报错如下
ERROR in Missing binding E:React
eact-redux-starter-kit-go
ode_modules
ode-sassvendorwin32-x64-47inding.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,比如我这里就要下载
win32-x64-47_binding.pdb
  • 将该文件改名放到E:React eact-redux-starter-kit-go ode_modules ode-sassvendorwin32-x64-47inding.node

方案二、

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

npm方式:

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

yarn方式:

npm install -g tyarn --registry=https://registry.npm.taobao.org
tyarn
-----------------------------------------------------
说明:
  a).代码仅供学习交流
  b).本文根据自身经验及网络总结所作,如有错误,谢谢指教
  c).转载请注明出处。
-----------------------------------------------------
原文地址:https://www.cnblogs.com/xqbumu/p/5748253.html