今天在用Node.js去构建项目的时候,npm install 遇到如下错误:
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at getNotFoundError (/Users/mac/IdeaProjects/mall-admin-web/node_modules/which/which.js:13:12)
......
解决的方法是通过淘宝的npm镜像去安装依赖,
npm install cnpm -g --registry=https://registry.npm.taobao.org
然后在所需构建的项目目录下使用cnpm install即可。