chatopera / node-synonyms

:ferris_wheel: 中文近义词工具包,聊天机器人
https://www.npmjs.com/package/node-synonyms
Other
69 stars 14 forks source link

Install failed with errors. #2

Open liudonghua123 opened 5 years ago

liudonghua123 commented 5 years ago

I tried to install with npm install node-synonyms -S, it gave me the following errors.

C:\Users\Liu.D.H\Desktop\node>npm install node-synonyms -S

> node-word2vec-reader@1.0.5 install C:\Users\Liu.D.H\Desktop\node\node_modules\node-word2vec-reader
> node-gyp rebuild

C:\Users\Liu.D.H\Desktop\node\node_modules\node-word2vec-reader>if not defined npm_config_node_gyp (node "C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  addon.cc
  reader.cc
  win_delay_load_hook.cc
c:\users\liu.d.h\desktop\node\node_modules\node-word2vec-reader\app\reader.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file
 in Unicode format to prevent data loss (compiling source file ..\app\reader.cc) [C:\Users\Liu.D.H\Desktop\node\node_modules\node-word2vec-reader\build\word2vec.vcxproj]
c:\users\liu.d.h\desktop\node\node_modules\node-word2vec-reader\app\addon.cc(10): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [C:\Users\Liu.D.H\Desktop\node\nod
e_modules\node-word2vec-reader\build\word2vec.vcxproj]
c:\users\liu.d.h\desktop\node\node_modules\node-word2vec-reader\app\reader.h(11): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory (compiling source file ..\app\read
er.cc) [C:\Users\Liu.D.H\Desktop\node\node_modules\node-word2vec-reader\build\word2vec.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Liu.D.H\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Liu.D.H\Desktop\node\node_modules\node-word2vec-reader
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN node@1.0.0 No description
npm WARN node@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-word2vec-reader@1.0.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-word2vec-reader@1.0.5 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\Liu.D.H\AppData\Roaming\npm-cache\_logs\2018-11-26T00_53_57_957Z-debug.log

C:\Users\Liu.D.H\Desktop\node>node -v
v11.0.0

C:\Users\Liu.D.H\Desktop\node>npm -v
6.4.1

C:\Users\Liu.D.H\Desktop\node>

I have tried chcp 437/936/65001, but none of these works.

liudonghua123 commented 5 years ago

I tried to fix this problem myself. TL;DR, try to add the following in package.json and install the dependences with yarn.

  "resolutions": {
    "node-synonyms/node-word2vec-reader": "git+https://github.com/liudonghua123/node-word2vec.git#node10_windows_patch"
  }