用npm安装ember-cli

时间:2015-11-09 08:59:37

标签: node.js ember.js npm ember-cli

我正在尝试使用NPM安装ember-cli包

npm install -g ember-cli

安装完成之前。我收到了这些错误。

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  bufferutil.cc
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _Nan
EnsureLocal(v8::Local<T>)': function template has already been defined [C:\Users\Murhaf\AppData\Roaming\npm\node_module
s\ember-cli\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(256): note: see declaration of '_Na
  nEnsureLocal'
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(661): error C3083: 'smalloc': the sym
bol to the left of a '::' must be a type [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\buffe
rutil\build\bufferutil.vcxproj]
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(661): error C2039: 'FreeCallback': is
 not a member of 'node' [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil\build\buffe
rutil.vcxproj]
  C:\Users\Murhaf\.node-gyp\5.0.0\include\node\node_object_wrap.h(8): note: see declaration of 'node'
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(661): error C2061: syntax error: iden
tifier 'FreeCallback' [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil\build\bufferu
til.vcxproj]
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(665): error C2065: 'callback': undecl
ared identifier [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil\build\bufferutil.vc
xproj]
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(665): error C2065: 'hint': undeclared
 identifier [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil\build\bufferutil.vcxpro
j]
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New
': none of the 4 overloads could convert all the argument types [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember
-cli\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\Murhaf\.node-gyp\5.0.0\include\node\node_buffer.h(43): note: could be 'v8::MaybeLocal<v8::Object> node::Buff
  er::New(v8::Isolate *,char *,size_t)'
  C:\Users\Murhaf\.node-gyp\5.0.0\include\node\node_buffer.h(31): note: or       'v8::MaybeLocal<v8::Object> node::Buff
  er::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)'
  C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(672): note: while trying to match t
  he argument list '(v8::Isolate *, const char *, uint32_t)'
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(676): error C2440: 'return': cannot c
onvert from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>' [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\e
mber-cli\node_modules\bufferutil\build\bufferutil.vcxproj]
  C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(676): note: No constructor could ta
  ke the source type, or constructor overload resolution was ambiguous
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(683): error C2039: 'Use': is not a me
mber of 'node::Buffer' [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil\build\buffer
util.vcxproj]
  C:\Users\Murhaf\.node-gyp\5.0.0\include\node\node_buffer.h(8): note: see declaration of 'node::Buffer'
C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\nan\nan.h(683): error C3861: 'Use': identifier
not found [C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:\Program Files\nodejs\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 Windows_NT 10.0.10240
gyp ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ember-cli"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6
npm ERR! code ELIFECYCLE

npm ERR! bufferutil@1.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@1.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\Users\Murhaf\Desktop\ember-cli\npm-debug.log

我正在使用PC win10 x64,我有node v5.0.0Python 2.7.10以及VS2015 (including WindowsSDK 8.1) ,我也有node-gyp v3.0.3

问题似乎出现在VS编译器中!我无法理解我在那里错过了什么?

2 个答案:

答案 0 :(得分:0)

卸载节点 ember-cli 以及与其相关的所有其他内容,并按照 ember-cli 用户的these说明进行操作 - 指南部分。一切都会好起来的;)。

PS:使用节点版本4.x.x,我也遇到了5.0.0的问题。

答案 1 :(得分:0)

在最近安装的节点上,我遇到了node-gyp的问题。事实证明问题必须在npm v 2.14.3上。请仔细检查您是否在使用npm -v的v3.x上。

正如Vitor Martins所提到的那样,也坚持使用节点4.x.x.