I recently updated node on my computer to 0.12.4. And that seems to have done something to a project I’m working inside node.js express.js. As near as I can tell there appears to be come kind of compatibility issue between the version of node I’m now running and the node_modules. I used Git to go back to previous versions of this project (versions which worked fine) and now they don’t work either.
My computer is running: OSX Yosemite 10.10.3 node: 0.12.4 npm: 2.11.3
My project’s dependancies in my package.json file:
"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"
}
The problem: When I run grunt
in the terminal I get errors telling me:
Loading "sass.js" tasks...ERROR
>> Error: Cannot find module 'node-sass'
Warning: Task "sass" not found. Use --force to continue.
So I removed all the node_modules and ran npm install
in the terminal and I get more errors:
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! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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.
What should I do?
You're using an ancient version of
node-sass
(^1.2.3, while the current version is 3.2.0), so try installing a more recent version (which installs just fine for me with Node 0.12):