我最近将计算机上的节点更新为 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"
}
问题:当我grunt
在终端中运行时,我收到错误消息告诉我:
Loading "sass.js" tasks...ERROR
>> Error: Cannot find module 'node-sass'
Warning: Task "sass" not found. Use --force to continue.
所以我删除了所有 node_modules 并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.
我应该怎么办?