react-boilerplate npm安装错误

时间:2015-10-26 02:30:17

标签: node.js reactjs npm flux

我遵循flux official tutorial

的工作流程

并尝试从react-boilerplate构建简单的模板项目 但是当我使用npm install时,发生了很多错误..

我在

下面选择一些输出
> node-gyp rebuild

  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
../node_modules/nan/nan.h:339:13: error: no member named 'New' in 'v8::String'
    return  _NAN_ERROR(v8::Exception::Error, errmsg);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:319:50: note: expanded from macro '_NAN_ERROR'
# define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))
                                     ~~~~~~~~~~~~^
../node_modules/nan/nan.h:343:5: error: no member named 'ThrowException' in namespace 'v8'
    _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:324:11: note: expanded from macro '_NAN_THROW_ERROR'
      v8::ThrowException(_NAN_ERROR(fun, errmsg));                             \
      ~~~~^

...

    /Users/mengwenqiaoxindongcom/.node-gyp/4.2.1/include/node/v8.h:2933:3: note: 'New' declared here
  static Local<Object> New(Isolate* isolate);
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/fse/fsevents.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/mengwenqiaoxindongcom/.nvm/versions/node/v4.2.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/Users/mengwenqiaoxindongcom/.nvm/versions/node/v4.2.1/bin/node" "/Users/mengwenqiaoxindongcom/.nvm/versions/node/v4.2.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mengwenqiaoxindongcom/pra/javascript/react-full_stack/flux/react-boilerplate/node_modules/jsxc/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN optional dep failed, continuing fsevents@0.2.1
envify@0.2.0 node_modules/envify
├── through@2.3.8
└── falafel@0.2.1 (esprima@1.1.0-dev)

我发现有些人解决了在v0.12.7v4.2.1之间更改节点版本的问题,但错误也会退出。

nvm ls
        v0.12.7
->      v4.2.1
        system
node -> stable (-> v4.2.1) (default)
stable -> 4.2 (-> v4.2.1) (default)
iojs -> N/A (default)

最后,我遵循此issue并注意到没人能正确解决这些错误。

有人能帮帮我吗?谢谢..

1 个答案:

答案 0 :(得分:0)

在搜索同一问题的解决方案时偶然发现了您的问题。刚刚检查了您链接到的issue,最终找到了解决方案。您可能已经看过它了,但如果没有,有人建议以下哪个对我有用:

  • 删除node_modules文件夹
  • npm install jest-cli --save-dev
  • npm install

问题是jest-cli期望较低版本的Node。因此,更新jest-cli似乎可以解决问题。