Mister-Hope/nodejs-jieba

Failed to compile in Windows

TechQuery opened this issue · 4 comments

@Mister-Hope, thanks for your modernize contribution, but some problem is still there.

Compiling Error in Installation

Same error as nodejieba@2.5.2 with Node.js 16.20.0 & PNPM 8.6.1 in Windows 10:

│ node-pre-gyp info it worked if it ends with ok
│ node-pre-gyp info using node-pre-gyp@1.0.10
│ node-pre-gyp info using node@16.20.0 | win32 | x64
│ node-pre-gyp info check checked for "D:\xxx\test\node_modules\.pnpm\nodejs-jieba@0.0.2\node_modu  
│ node-pre-gyp http GET https://github.com/Mister-Hope/nodejs-jieba/releases/download/v0.0.2/jieba-v0.0.2-node-v93-w  
│ node-pre-gyp http download proxy agent configured using: "http://127.0.0.1:59870"
│ node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Mister-Hope/nodejs-jieba/releases/do  
│ node-pre-gyp WARN Pre-built binaries not installable for nodejs-jieba@0.0.2 and node@16.20.0 (node-v93 ABI, unknow  
│ node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Mister-Hope/nodejs-jieba/releases/  
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.3.1
│ gyp info using node@16.20.0 | win32 | x64
│ gyp info ok 
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.3.1
│ gyp info using node@16.20.0 | win32 | x64
│ gyp info find Python using Python version 3.10.1 found at "C:\Python310\python.exe"
│ gyp http GET https://npm.taobao.org/dist/v16.20.0/node-v16.20.0-headers.tar.gz
│ gyp http 200 https://cdn.npmmirror.com/binaries/node/v16.20.0/node-v16.20.0-headers.tar.gz
│ gyp http GET https://npm.taobao.org/dist/v16.20.0/SHASUMS256.txt
│ gyp http GET https://npm.taobao.org/dist/v16.20.0/win-x64/node.lib
│ gyp http GET https://npm.taobao.org/dist/v16.20.0/win-x86/node.lib
│ gyp http GET https://npm.taobao.org/dist/v16.20.0/win-arm64/node.lib
│ gyp http 200 https://cdn.npmmirror.com/binaries/node/v16.20.0/SHASUMS256.txt
│ gyp http 200 https://cdn.npmmirror.com/binaries/node/v16.20.0/win-x86/node.lib
│ gyp http 200 https://cdn.npmmirror.com/binaries/node/v16.20.0/win-x64/node.lib
│ gyp http 404 https://cdn.npmmirror.com/binaries/node/v16.20.0/win-arm64/node.lib
│ gyp info find VS using VS2015 (14.0) found at:
│ gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
│ gyp info find VS run with --verbose for detailed information
│ gyp info spawn C:\Python310\python.exe
│ gyp info spawn args [
│ gyp info spawn args   'C:\\Users\\xxx\\AppData\\Local\\node\\corepack\\pnpm\\8.6.1\\dist\\node_modules\\node  
│ gyp info spawn args   'binding.gyp',
│ gyp info spawn args   '-f',
│ gyp info spawn args   'msvs',
│ gyp info spawn args   '-I',
│ gyp info spawn args   'D:\\xxx\\test\\node_modules\\.pnpm\\nodejs-jieba@0.0.2\\node_modules\\no  
│ gyp info spawn args   '-I',
│ gyp info spawn args   'C:\\Users\\xxx\\AppData\\Local\\node\\corepack\\pnpm\\8.6.1\\dist\\node_modules\\node  
│ gyp info spawn args   '-I',
│ gyp info spawn args   'C:\\Users\\xxx\\AppData\\Local\\node-gyp\\Cache\\16.20.0\\include\\node\\common.gypi'  
│ gyp info spawn args   '-Dlibrary=shared_library',
│ gyp info spawn args   '-Dvisibility=default',
│ gyp info spawn args   '-Dnode_root_dir=C:\\Users\\xxx\\AppData\\Local\\node-gyp\\Cache\\16.20.0',
│ gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\xxx\\AppData\\Local\\node\\corepack\\pnpm\\8.6.1\\dist\\nod  
│ gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\xxx\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.20.  
│ gyp info spawn args   '-Dmodule_root_dir=D:\\xxx\\test\\node_modules\\.pnpm\\nodejs-jieba@0.0.2  
│ gyp info spawn args   '-Dnode_engine=v8',
│ gyp info spawn args   '--depth=.',
│ gyp info spawn args   '--no-parallel',
│ gyp info spawn args   '--generator-output',
│ gyp info spawn args   'D:\\xxx\\test\\node_modules\\.pnpm\\nodejs-jieba@0.0.2\\node_modules\\no  
│ gyp info spawn args   '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp info ok 
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.3.1
│ gyp info using node@16.20.0 | win32 | x64
│ gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe
│ gyp info spawn args [
│ gyp info spawn args   'build/binding.sln',
│ gyp info spawn args   '/clp:Verbosity=minimal',
│ gyp info spawn args   '/nologo',
│ gyp info spawn args   '/p:Configuration=Release;Platform=x64'
│ gyp info spawn args ]
│ �ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�/m�����ء�
│ cl : Command line warning D9002: ignoring unknown option '/Zc:__cplusplus' [D:\xxx\test\node_mod  
│   index.cpp
│ d:\xxx\test\node_modules\.pnpm\node-addon-api@6.1.0\node_modules\node-addon-api\napi-inl.h(6499)  
│   d:\xxx\test\node_modules\.pnpm\node-addon-api@6.1.0\node_modules\node-addon-api\napi-inl.h(565  
│   D:\xxx\test\node_modules\.pnpm\node-addon-api@6.1.0\node_modules\node-addon-api\napi.h(295): n  
│   d:\xxx\test\node_modules\.pnpm\node-addon-api@6.1.0\node_modules\node-addon-api\napi-inl.h(649  
│   ..\lib\index.cpp(3): note: see reference to function template instantiation 'Napi::Object Napi::Addon<NodeJieba>  
│   d:\xxx\test\node_modules\.pnpm\nodejs-jieba@0.0.2\node_modules\nodejs-jieba\lib\nodejieba.h(8)  
│ 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\xxx\AppData\Local\node\corepack\pnpm\8.6.1\dist\node_mod  
│ gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
│ gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
│ gyp ERR! System Windows_NT 10.0.19045
│ gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xxx\\AppData\\Local\\node\\corepack\\pnpm  
│ gyp ERR! cwd D:\xxx\test\node_modules\.pnpm\nodejs-jieba@0.0.2\node_modules\nodejs-jieba
│ gyp ERR! node -v v16.20.0
│ gyp ERR! node-gyp -v v9.3.1
│ gyp ERR! not ok 
│ node-pre-gyp ERR! build error 
│ node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\xxx\AppData\Loca  
│ node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\xxx\test\node_modules\.pnpm\@mapbox+  
│ node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
│ node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
│ node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
│ node-pre-gyp ERR! System Windows_NT 10.0.19045
│ node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\xxx\\test\\node_modules\\.  
│ node-pre-gyp ERR! cwd D:\xxx\test\node_modules\.pnpm\nodejs-jieba@0.0.2\node_modules\nodejs-jieb  
│ node-pre-gyp ERR! node -v v16.20.0
│ node-pre-gyp ERR! node-pre-gyp -v v1.0.10
│ node-pre-gyp ERR! not ok
│ Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\xxx\AppData\Local\node\corepack\pnpm\8.6.1\dist  
└─ Failed in 28s at D:\xxx\test\node_modules\.pnpm\nodejs-jieba@0.0.2\node_modules\nodejs-jieba     
 ELIFECYCLE  Command failed with exit code 1.

Npm taobao org has been deprecated long ago, use a GitHub mirror to download assets from GitHub.

Also, vs2015 may also too old for gcc, at least everything works fine for me with vs2022.

Finally, you are not providing the full log. Long lines are cut off, so I am not sure why an pre-built binary not found.

Npm taobao org has been deprecated long ago, use a GitHub mirror to download assets from GitHub.

Also, vs2015 may also too old for gcc, at least everything works fine for me with vs2022.

  1. TaoBao mirror is a history, it works after removing pnpm-lock.yaml & re-installing.
  2. I have no Visual Studio 2015 IDE, its compiler may be installed by Node-GYP, I don't know how to upgrade it.
imnxg commented

使用npm i拉取依赖失败
环境:window10、node.js V18.16.1
使用:"nodejs-jieba":"0.1.2"
删除了项目中的lock.js和node_modules
有科学上网环境,本地可以正常拉取Github代码和提交代码

本地拉取报错:

D:\blogsource\weekly-vuepress>npm i
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path D:\Program Files\nodejs\node_cache\_cacache\tmp\f5afc9c7
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmmirror.com/nodejs-jieba: EPERM: operation not permitted, open 'D:\Program Files\nodejs\node_cache\_cacache\tmp\f5afc9c7'
npm ERR!     at D:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:170:15
npm ERR!     at async Response.json (D:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:75:17)
npm ERR!     at async RegistryFetcher.packument (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\registry.js:94:25)
npm ERR!     at async RegistryFetcher.manifest (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\registry.js:118:23)
npm ERR!     at async [nodeFromEdge] (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1059:19)
npm ERR!     at async [buildDepStep] (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:929:11)
npm ERR!     at async Arborist.buildIdealTree (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:207:7)
npm ERR!     at async Promise.all (index 1)
npm ERR!     at async Arborist.reify (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:159:5)
npm ERR!     at async Install.exec (D:\Program Files\nodejs\node_modules\npm\lib\commands\install.js:146:5)
npm ERR!  FetchError: Invalid response body while trying to fetch https://registry.npmmirror.com/nodejs-jieba: EPERM: operation not permitted, open 'D:\Program Files\nodejs\node_cache\_cacache\tmp\f5afc9c7'
npm ERR!     at D:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:170:15
npm ERR!     at async Response.json (D:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:75:17)
npm ERR!     at async RegistryFetcher.packument (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\registry.js:94:25)
npm ERR!     at async RegistryFetcher.manifest (D:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\registry.js:118:23)
npm ERR!     at async [nodeFromEdge] (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1059:19)
npm ERR!     at async [buildDepStep] (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:929:11)
npm ERR!     at async Arborist.buildIdealTree (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:207:7)
npm ERR!     at async Promise.all (index 1)
npm ERR!     at async Arborist.reify (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:159:5)
npm ERR!     at async Install.exec (D:\Program Files\nodejs\node_modules\npm\lib\commands\install.js:146:5) {
npm ERR!   code: 'EPERM',
npm ERR!   errno: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'D:\\Program Files\\nodejs\\node_cache\\_cacache\\tmp\\f5afc9c7',
npm ERR!   type: 'system',
npm ERR!   requiredBy: '.'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! Log files were not written due to an error writing to the directory: D:\Program Files\nodejs\node_cache\_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

把你的错误扔到翻译软件里自己理解一下,不要总在别人的 issue 下贴无关的内容。