node-gyp错误找不到模块'/node_modules/node-gyp/bin/node-gyp.js'

为什么当node-gyp本身安装在/ usr / bin / node-gyp中时,它在绝对path中查找node-gyp.js? 如果我做

find /usr -name node-gyp.js 

结果是

 /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js /usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js 

可以看出,我在两个地方有node-gyp.js。 我该如何指导node-gyp来search这些地方?

这是一个节点安装麻烦。 我使用的是旧版本的npm; 升级npm后,node-gyp安装成功并运行正常。