我的系统上更新的节点,现在grunt不会在npm项目中运行

我最近更新了我的电脑上的节点到0.12.4。 而这似乎已经做了一些项目,我正在node.js express.js工作。 据我所知,似乎现在正在运行的节点版本和node_modules之间出现了一种兼容性问题。 我用Git回到这个项目的早期版本(版本工作正常),现在他们也不工作。

我的电脑正在运行:OSX Yosemite 10.10.3节点:0.12.4 npm:2.11.3

我的项目依赖于我的package.json文件:

"dependencies": { "body-parser": "~1.8.1", "cookie-parser": "~1.3.3", "debug": "~2.0.0", "express": "~4.9.0", "grunt": "^0.4.5", "grunt-sass": "^0.17.0", "jade": "~1.6.0", "morgan": "~1.3.0", "node-sass": "^1.2.3", "serve-favicon": "~2.1.3" }, "devDependencies": { "grunt-contrib-watch": "^0.6.1" } 

问题:当我在terminal运行grunt时,我得到错误告诉我:

  Loading "sass.js" tasks...ERROR >> Error: Cannot find module 'node-sass' Warning: Task "sass" not found. Use --force to continue. 

所以我删除了所有的node_modules,并在terminal中运行npm install ,我得到了更多的错误:

  Error: Module did not self-register. at Error (native) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.<anonymous> (/Users/sheynawatkins/dev/node/lola/node_modules/node-sass/lib/index.js:181:15) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) npm ERR! Darwin 14.3.0 npm ERR! argv "node" "/usr/local/bin/npm" "install" npm ERR! node v0.12.4 npm ERR! npm v2.11.3 npm ERR! code ELIFECYCLE npm ERR! node-sass@1.2.3 postinstall: `node scripts/build.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@1.2.3 postinstall script 'node scripts/build.js'. npm ERR! This is most likely a problem with the node-sass package, npm ERR! not with npm itself. 

我该怎么办?

您使用的是古老版本的node-sass (^ 1.2.3,而当前版本是3.2.0),所以请尝试安装更新的版本(对于Node 0.12,我将安装这个版本):

 $ npm i node-sass@latest --save