Fail to npm install -g particle-cli on windows

Hi all

I meet huge problems to run the command npm install -g particle-cli on my windows laptop. Config
win8 x64
Visual studio 2013 ultimate
node.js
Python 2.7

and when I run the command npm install -g particle-cli I got all those crazy messages

C:\Users\usertest>npm install -g particle-cli
npm WARN engine particle-cli@1.8.3: wanted: {"node":"0.10 - 0.12"} (current: {"n
ode":"4.1.1","npm":"2.14.4"})
-
> serialport@1.7.4 install C:\Users\usertest\AppData\Roaming\npm\node_modules\pa
rticle-cli\node_modules\serialport
> node-pre-gyp install --fallback-to-build

Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
  serialport.cpp
  serialport_win.cpp
  enumser.cpp
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLoca
l(v8::Local<T>)' : function template has already been defined (..\src\serialpor
t.cpp) [C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_mo
dules\serialport\build\serialport.vcxproj]
          C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_
  modules\serialport\node_modules\nan\nan.h(256) : see declaration of '_NanEnsu
  reLocal'
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLoca
l(v8::Local<T>)' : function template has already been defined (..\src\serialpor
t_win.cpp) [C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\nod
e_modules\serialport\build\serialport.vcxproj]
          C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_
  modules\serialport\node_modules\nan\nan.h(256) : see declaration of '_NanEnsu
  reLocal'
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the
 left of a '::' must be a type (..\src\serialport_win.cpp) [C:\Users\usertest\A
ppData\Roaming\npm\node_modules\particle-cli\node_modules\serialport\build\seri
alport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the
 left of a '::' must be a type (..\src\serialport.cpp) [C:\Users\usertest\AppDa
ta\Roaming\npm\node_modules\particle-cli\node_modules\serialport\build\serialpo
rt.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(661): error C2039: 'FreeCallback' : is not a me
mber of 'node' (..\src\serialport_win.cpp) [C:\Users\usertest\AppData\Roaming\n
pm\node_modules\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(661): error C2039: 'FreeCallback' : is not a me
mber of 'node' (..\src\serialport.cpp) [C:\Users\usertest\AppData\Roaming\npm\n
ode_modules\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(661): error C2061: syntax error : identifier 'F
reeCallback' (..\src\serialport_win.cpp) [C:\Users\usertest\AppData\Roaming\npm
\node_modules\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(661): error C2061: syntax error : identifier 'F
reeCallback' (..\src\serialport.cpp) [C:\Users\usertest\AppData\Roaming\npm\nod
e_modules\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(665): error C2065: 'callback' : undeclared iden
tifier (..\src\serialport_win.cpp) [C:\Users\usertest\AppData\Roaming\npm\node_
modules\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(665): error C2065: 'callback' : undeclared iden
tifier (..\src\serialport.cpp) [C:\Users\usertest\AppData\Roaming\npm\node_modu
les\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(665): error C2065: 'hint' : undeclared identifi
er (..\src\serialport_win.cpp) [C:\Users\usertest\AppData\Roaming\npm\node_modu
les\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(665): error C2065: 'hint' : undeclared identifi
er (..\src\serialport.cpp) [C:\Users\usertest\AppData\Roaming\npm\node_modules\
particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(665): error C2664: 'v8::Local<v8::Object>::Loca
l(const v8::Local<v8::Object> &)' : cannot convert argument 1 from 'v8::MaybeLo
cal<v8::Object>' to 'const v8::Local<v8::Object> &' (..\src\serialport_win.cpp)
 [C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\
serialport\build\serialport.vcxproj]
          Reason: cannot convert from 'v8::MaybeLocal<v8::Object>' to 'const v8
  ::Local<v8::Object>'
          No user-defined-conversion operator available that can perform this c
  onversion, or the operator cannot be called
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(665): error C2664: 'v8::Local<v8::Object>::Loca
l(const v8::Local<v8::Object> &)' : cannot convert argument 1 from 'v8::MaybeLo
cal<v8::Object>' to 'const v8::Local<v8::Object> &' (..\src\serialport.cpp) [C:
\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\seri
alport\build\serialport.vcxproj]
          Reason: cannot convert from 'v8::MaybeLocal<v8::Object>' to 'const v8
  ::Local<v8::Object>'
          No user-defined-conversion operator available that can perform this c
  onversion, or the operator cannot be called
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New' : none o
f the 4 overloads could convert all the argument types (..\src\serialport_win.c
pp) [C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modul
es\serialport\build\serialport.vcxproj]
          C:\Users\usertest\.node-gyp\4.1.1\include\node\node_buffer.h(43): cou
  ld be 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,char *,size
  _t)'
          C:\Users\usertest\.node-gyp\4.1.1\include\node\node_buffer.h(31): or
        'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,v8::Local<v
  8::String>,node::encoding)'
          while trying to match the argument list '(v8::Isolate *, const char *
  , uint32_t)'
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New' : none o
f the 4 overloads could convert all the argument types (..\src\serialport.cpp)
[C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\s
erialport\build\serialport.vcxproj]
          C:\Users\usertest\.node-gyp\4.1.1\include\node\node_buffer.h(43): cou
  ld be 'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,char *,size
  _t)'
          C:\Users\usertest\.node-gyp\4.1.1\include\node\node_buffer.h(31): or
        'v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate *,v8::Local<v
  8::String>,node::encoding)'
          while trying to match the argument list '(v8::Isolate *, const char *
  , uint32_t)'
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(676): error C2664: 'v8::Local<v8::Object>::Loca
l(const v8::Local<v8::Object> &)' : cannot convert argument 1 from 'v8::MaybeLo
cal<v8::Object>' to 'const v8::Local<v8::Object> &' (..\src\serialport_win.cpp)
 [C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\
serialport\build\serialport.vcxproj]
          Reason: cannot convert from 'v8::MaybeLocal<v8::Object>' to 'const v8
  ::Local<v8::Object>'
          No user-defined-conversion operator available that can perform this c
  onversion, or the operator cannot be called
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(676): error C2664: 'v8::Local<v8::Object>::Loca
l(const v8::Local<v8::Object> &)' : cannot convert argument 1 from 'v8::MaybeLo
cal<v8::Object>' to 'const v8::Local<v8::Object> &' (..\src\serialport.cpp) [C:
\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\seri
alport\build\serialport.vcxproj]
          Reason: cannot convert from 'v8::MaybeLocal<v8::Object>' to 'const v8
  ::Local<v8::Object>'
          No user-defined-conversion operator available that can perform this c
  onversion, or the operator cannot be called
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(683): error C2039: 'Use' : is not a member of '
node::Buffer' (..\src\serialport_win.cpp) [C:\Users\usertest\AppData\Roaming\np
m\node_modules\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(683): error C2039: 'Use' : is not a member of '
node::Buffer' (..\src\serialport.cpp) [C:\Users\usertest\AppData\Roaming\npm\no
de_modules\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found
(..\src\serialport_win.cpp) [C:\Users\usertest\AppData\Roaming\npm\node_modules
\particle-cli\node_modules\serialport\build\serialport.vcxproj]
C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\se
rialport\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found
(..\src\serialport.cpp) [C:\Users\usertest\AppData\Roaming\npm\node_modules\par
ticle-cli\node_modules\serialport\build\serialport.vcxproj]
..\src\win\enumser.cpp(443): warning C4996: 'GetVersionExA': was declared depre
cated [C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_mod
ules\serialport\build\serialport.vcxproj]
          C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433)
  : see declaration of 'GetVersionExA'
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\usertest\AppData\Roaming\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_proces
s.js:200:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\usertest\\App
Data\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallbac
k-to-build" "--module=C:\\Users\\usertest\\AppData\\Roaming\\npm\\node_modules\\
particle-cli\\node_modules\\serialport\\build\\serialport\\v1.7.4\\Release\\node
-v46-win32-x64\\serialport.node" "--module_name=serialport" "--module_path=C:\\U
sers\\usertest\\AppData\\Roaming\\npm\\node_modules\\particle-cli\\node_modules\
\serialport\\build\\serialport\\v1.7.4\\Release\\node-v46-win32-x64"
gyp ERR! cwd C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\nod
e_modules\serialport
gyp ERR! node -v v4.1.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.e
xe C:\Users\usertest\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js b
uild --fallback-to-build --module=C:\Users\usertest\AppData\Roaming\npm\node_mod
ules\particle-cli\node_modules\serialport\build\serialport\v1.7.4\Release\node-v
46-win32-x64\serialport.node --module_name=serialport --module_path=C:\Users\leb
osseg\AppData\Roaming\npm\node_modules\particle-cli\node_modules\serialport\buil
d\serialport\v1.7.4\Release\node-v46-win32-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\usertest\AppDa
ta\Roaming\npm\node_modules\particle-cli\node_modules\serialport\node_modules\no
de-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:817:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/chi
ld_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 6.3.9600
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\lebo
sseg\\AppData\\Roaming\\npm\\node_modules\\particle-cli\\node_modules\\serialpor
t\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build
"
node-pre-gyp ERR! cwd C:\Users\usertest\AppData\Roaming\npm\node_modules\particl
e-cli\node_modules\serialport
node-pre-gyp ERR! node -v v4.1.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.7
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\usertest\AppData\Ro
aming\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --modu
le=C:\Users\usertest\AppData\Roaming\npm\node_modules\particle-cli\node_modules\
serialport\build\serialport\v1.7.4\Release\node-v46-win32-x64\serialport.node --
module_name=serialport --module_path=C:\Users\usertest\AppData\Roaming\npm\node_
modules\particle-cli\node_modules\serialport\build\serialport\v1.7.4\Release\nod
e-v46-win32-x64' (1)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "particle-cli"
npm ERR! node v4.1.1
npm ERR! npm  v2.14.4
npm ERR! code ELIFECYCLE

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

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\usertest\npm-debug.log

The serialport module is not compatible with node 4.0. You need to install an earlier version of node.js.

1 Like

ok thanks…is there a specific version to install ? or any under 4.0 ?

oups sorry ok :

“b version 0.10.40 from the Node.js website”

0.12.7 is the latest known working one I believe, that should be okay as well :smile:

issue is… after installing nojes.js 4 how to install previous one. I keep getting message after uninstall that I am using version 4 and I installed 0.12

Picking the right one here should work. It did for me:
https://nodejs.org/dist/v0.12.7/

1 Like

working now…thx

Now issue is trying to load first example led-blink on samples, I load OK, but after particle resets … and never runs the code.

Thanks for this post! It saved me from hours of head v desk bashing.

2 Likes