Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 更新了我的系统上的节点,现在grunt赢了';未在npm项目中运行_Node.js_Npm_Node Sass - Fatal编程技术网

Node.js 更新了我的系统上的节点,现在grunt赢了';未在npm项目中运行

Node.js 更新了我的系统上的节点,现在grunt赢了';未在npm项目中运行,node.js,npm,node-sass,Node.js,Npm,Node Sass,我最近将计算机上的节点更新为0.12.4。这似乎对我在node.js express.js中工作的项目起到了一定的作用。据我所知,我现在运行的node版本和node_模块之间似乎存在某种兼容性问题。我使用Git返回到这个项目的早期版本(工作正常的版本),现在它们也不工作了 我的计算机正在运行: 约塞米蒂OSX 10.10.3 节点:0.12.4 净现值:2.11.3 My package.json文件中的项目依赖项: "dependencies": { "body-parse

我最近将计算机上的节点更新为0.12.4。这似乎对我在node.js express.js中工作的项目起到了一定的作用。据我所知,我现在运行的node版本和node_模块之间似乎存在某种兼容性问题。我使用Git返回到这个项目的早期版本(工作正常的版本),现在它们也不工作了

我的计算机正在运行: 约塞米蒂OSX 10.10.3 节点:0.12.4 净现值:2.11.3

My 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_模块,并在终端中运行了
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. 
错误:模块未自注册。
错误(本机)
在Module.load(Module.js:355:32)
在Function.Module.\u加载(Module.js:310:12)
at Module.require(Module.js:365:17)
根据需要(module.js:384:17)
反对。(/Users/sheynawatkins/dev/node/lola/node_modules/node sass/lib/index.js:181:15)
在模块处编译(Module.js:460:26)
在Object.Module.\u extensions..js(Module.js:478:10)
在Module.load(Module.js:355:32)
在Function.Module.\u加载(Module.js:310:12)
npm错误!达尔文14.3.0
npm错误!argv“node”“/usr/local/bin/npm”“安装”
npm错误!节点v0.12.4
npm错误!npm v2.11.3
npm错误!代码失效循环
npm错误!节点-sass@1.2.3postinstall:`node scripts/build.js`
npm错误!退出状态1
npm错误!
npm错误!在节点上失败-sass@1.2.3安装后脚本“节点脚本/build.js”。
npm错误!这很可能是节点sass包的问题,
npm错误!与npm本身无关。

我该怎么办?

您使用的是一个古老版本的
节点sass
(^1.2.3,而当前版本是3.2.0),因此请尝试安装一个更新的版本(对于我来说,节点0.12安装得很好):


是的,这就是问题所在。之后,我还必须更新grunt sass,现在grunt将正常运行。非常感谢。
$ npm i node-sass@latest --save