2015-11-23 49 views
0

我一直在努力争取这一整套设置,并始终面临同样的问题......我想知道是否有人可以帮助,我完全卡住了。我已经安装了node.js和NPM,使用brew在我的mac上,这似乎都运行良好,我得到它运行没有任何错误(最终!)MEAN堆栈哟meanjs在创建新项目时返回错误

当我运行yo meanjs这是发生了什么....

You're using the official MEAN.JS generator. 
? What mean.js version would you like to generate? 0.4.1 
0.4.1 
? In which folder would you like the project to be generated? This can  be changed later. mean 
Cloning the MEAN repo....... 
? What would you like to call your application? MEAN 
? How would you describe your application? Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js 
? How would you describe your application in comma seperated key words? MongoDB, Express, AngularJS, Node.js 
? What is your company/author name? Jane 
? Would you like to generate the article example CRUD module? No 
? Would you like to generate the chat example module? No 
create mean/package.json 
create mean/bower.json 
create mean/config/env/default.js 
Running npm install for you.... 

然后我收到以下错误(错误的部分结果作为其太长,此... 450行!):

Error: Command failed: /bin/sh -c cd mean && npm install 
 
    npm WARN engine [email protected]: wanted: {"node":">=0.8 <=0.12 || >=1 <=2"} (current: {"node":"5.1.0","npm":"3.3.12"}) 
 
    npm WARN prefer global [email protected] should be installed with -g 
 
    npm WARN prefer global [email protected] should be installed with -g 
 
    npm WARN prefer global [email protected] should be installed with -g 
 
    npm WARN prefer global [email protected] should be installed with -g 
 
    /Users/Jane/myMeanProject/mean/node_modules/.bin/touch: line 1: syntax error near unexpected token `(' 
 
    /Users/Jane/myMeanProject/mean/node_modules/.bin/touch: line 1: `var touch = require("../touch")' 
 
    make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 2 
 
    gyp ERR! build error 
 
    gyp ERR! stack Error: `make` failed with exit code: 2 
 
    gyp ERR! stack  at ChildProcess.onExit (/usr/local/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 15.0.0 
 
    gyp ERR! command "/usr/local/Cellar/node/5.1.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
 
    gyp ERR! cwd /Users/Jane/myMeanProject/mean/node_modules/bufferutil 
 
    gyp ERR! node -v v5.1.0 
 
    gyp ERR! node-gyp -v v3.0.3 
 
    gyp ERR! not ok 
 
    npm WARN install:[email protected] [email protected] install: `node-gyp rebuild` 
 
    npm WARN install:[email protected] Exit status 1 
 
    In file included from ../src/bufferutil.cc:16: 
 
    ../../nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal' 
 
    NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) { 
 
          ^
 
    ../../nan/nan.h:256:25: note: previous definition is here 
 
    NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) { 
 
          ^
 
    ../../nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node' 
 
     , node::smalloc::FreeCallback callback 
 
      ~~~~~~^ 
 
    ../../nan/nan.h:672:12: error: no matching function for call to 'New' 
 
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); 
 
       ^~~~~~~~~~~~~~~~~ 
 

任何人都可以指出我在正确的方向我是一个newby这个,非常困惑,为什么它不工作!我尝试删除所有内容并重新安装,但此时我仍然碰到了一堵砖墙。

回答

0

这一切的一天后争夺我想出答案张贴之后......问题是与节点版本wanted: {"node":">=0.8 <=0.12 || >=1 <=2"}

要解决这个问题,你需要....

  1. 安装自制软件版本$ brew tap homebrew/versions
  2. $ brew search node会显示您可以使用的版本列表。选择最好的一个,为您和
  3. brew unlink node,以确保它是无关联然后最后
  4. $ brew install node010安装0.10版的Node.js

感谢https://apple.stackexchange.com/questions/171530/how-do-i-downgrade-node-or-install-a-specific-previous-version-using-homebrew