luckykaiyi / nodejieba

"结巴"中文分词的Node.js版本

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

version 2.2.2 Can't build on Win 10 x64

tw0517tw opened this issue · comments

> nodejieba@2.2.2 install D:\------\node_modules\nodejieba
> node-gyp rebuild


D:\------\node_modules\nodejieba>if not defined npm_config_node_gyp (node "C:\Users\------\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\
..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
在這個方案中一次建置一個專案。若要啟用平行組建,請加入 "/m" 參數。
  index.cpp
  nodejieba.cpp
d:\------\node_modules\nodejieba\lib\utils.h(19): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data (compiling
source file ..\lib\index.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\lib\utils.h(19): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data (compiling
source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\lib\utils.h(35): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data (compiling
source file ..\lib\index.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\lib\utils.h(35): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data (compiling
source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\lib\utils.h(51): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data (compiling
source file ..\lib\index.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\lib\utils.h(51): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data (compiling
source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nan\nan_new.h(208): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data (compiling source file
..\lib\index.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
  d:\------\node_modules\nodejieba\lib\utils.h(17): note: see reference to function template instantiation 'v8::Local<v8::Array> Nan::New<v8::Array,un
  signed __int64>(A0)' being compiled
          with
          [
              A0=unsigned __int64
          ] (compiling source file ..\lib\index.cpp)
d:\------\node_modules\nodejieba\deps\cppjieba\Unicode.hpp(141): warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of d
ata (compiling source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\deps\cppjieba\SegmentBase.hpp : warning C4819: The file contains a character that cannot be represented in the curren
t code page (950). Save the file in Unicode format to prevent data loss (compiling source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba
\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\deps\cppjieba\SegmentBase.hpp(11): error C2001: newline in constant (compiling source file ..\lib\nodejieba.cpp) [D:\
------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\deps\cppjieba\SegmentBase.hpp(13): error C2143: syntax error: missing ';' before 'using namespace' (compiling source
file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\deps\cppjieba\FullSegment.hpp(76): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data (comp
iling source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\deps\cppjieba\SegmentTagged.hpp(8): warning C4099: 'cppjieba::DictTrie': type name first seen using 'class' now seen
using 'struct' (compiling source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
  d:\------\node_modules\nodejieba\deps\cppjieba\DictTrie.hpp(27): note: see declaration of 'cppjieba::DictTrie' (compiling source file ..\lib\nodejie
  ba.cpp)
d:\------\node_modules\nodejieba\deps\cppjieba\SegmentTagged.hpp(19): warning C4099: 'cppjieba::DictTrie': type name first seen using 'class' now seen
 using 'struct' (compiling source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
  d:\------\node_modules\nodejieba\deps\cppjieba\SegmentTagged.hpp(8): note: see declaration of 'cppjieba::DictTrie' (compiling source file ..\lib\nod
  ejieba.cpp)
d:\------\node_modules\nodejieba\deps\cppjieba\HMMSegment.hpp(162): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data (comp
iling source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\------\node_modules\nodejieba\deps\cppjieba\HMMSegment.hpp(178): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of
 data (compiling source file ..\lib\nodejieba.cpp) [D:\------\node_modules\nodejieba\build\nodejieba.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\------\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\------\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.j
s" "rebuild"
gyp ERR! cwd D:\------\node_modules\nodejieba
gyp ERR! node -v v6.2.2
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\------\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "-std=c++11"
npm ERR! node v6.2.2
npm ERR! npm  v3.8.7
npm ERR! code ELIFECYCLE

npm ERR! nodejieba@2.2.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejieba@2.2.2 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nodejieba 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 information on how to open an issue for this project with:
npm ERR!     npm bugs nodejieba
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls nodejieba
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

目测是源码里面有 utf8的中文,可能你的 visual studio 不支持 utf8 中文?

I've changed the shell I use from GitBash to PowerShell and successfully built it. Thanks.

win 7 x64 @2.2.4 也不行,同样的问题

D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: '__pfnDliNot
ifyHook2': redefinition; different type modifiers [D:\node\segmentation\node_modules\nodejieba\build\nodejieba.vcxproj]
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134): note: see declaration of '__pfnDliNot
  ifyHook2'
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:2
76: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 6.1.7601
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\node\segmentation\node_modules\nodejieba
gyp ERR! node -v v4.4.4
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"
"nodejieba" "--save"
npm ERR! node v4.4.4
npm ERR! npm  v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! nodejieba@2.2.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejieba@2.2.4 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the nodejieba 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 information on how to open an issue for this project with:
npm ERR!     npm bugs nodejieba
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls nodejieba
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\node\segmentation\npm-debug.log

有知道怎么解决吗,或者你们有没有编译好的代码包

win7 64位,请使用nodejs 0.12.X 版本,高版本有问题。VS2010、2012、2013、2015都可以。

低版本依然不行,
我是手動下載,但是初始測試時
都會產生not find build/......

有任何方法可以測試嗎?
只有安裝nodejs就可以使用嗎?

@huguoba 好吧,我用 nvm-windows 包,切换node到4.6也是可以的,哈哈!

@mygoodboy 我用的是npm安装的,只要把node-gyp装上就可以了,不过这个比较麻烦,windows的话选择有两种方法,我选择的是option 1

@mygoodboy 手动下载肯定是不行的,因为需要编译,如果不行一般都是 node-gyp 和 npm 的版本不对,建议重装一下 node-gyp 和 npm 。

$ npm install nodejieba -g

nodejieba@2.3.0 install C:\Users\amz\AppData\Roaming\npm\node_modules\nodejieba
node-gyp rebuild

C:\Users\amz\AppData\Roaming\npm\node_modules\nodejieba>if not defined npm_config_node_gyp (node "C:\amz\▒▒▒▒\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\amz\▒▒▒▒\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\python\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\amz\工具\node.exe" "C:\amz\工具\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\amz\AppData\Roaming\npm\node_modules\nodejieba
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nodejieba@2.3.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejieba@2.3.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\amz\AppData\Roaming\npm-cache_logs\2019-04-22T10_25_24_368Z-debug.log