安装 tesseract.js
Install tesseract.js
无法通过 npm i -G tesseract
安装 tesseract.js
Windows10、npm版本6.8.0
错误:
!
C:\WINDOWS\system32\node_modules\tesseract>if not defined npm_config_node_gyp (node "C:\Users\andre\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\andre\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
MSBUILD : error MSB1009: file of project not exists.
Ключ: build/binding.sln
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio17\BuildTools\MSBuild.0\Bin\MSBuild.exe
failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\WINDOWS\system32\node_modules\tesseract
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json'
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tesseract@0.0.3 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tesseract@0.0.3 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\andre\AppData\Roaming\npm-cache_logs19-05-29T21_46_48_037Z-debug.log
日志文件
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\andre\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'i',
1 verbose cli '-G',
1 verbose cli 'tesseract' ]
2 info using npm@6.8.0
3 info using node@v10.15.3
4 verbose npm-session 30233da101cd2793
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/tesseract 315ms (from cache)
8 silly pacote tag manifest for tesseract@latest fetched in 327ms
9 timing stage:loadCurrentTree Completed in 344ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 0ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule tesseract@0.0.3 checking installable status
17 timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 4ms
18 timing stage:loadIdealTree Completed in 6ms
19 silly currentTree system32
20 silly idealTree system32
20 silly idealTree `-- tesseract@0.0.3
21 silly install generateActionsToTake
22 timing stage:generateActionsToTake Completed in 3ms
23 silly diffTrees action count 1
24 silly diffTrees add tesseract@0.0.3
25 silly decomposeActions action count 8
26 silly decomposeActions fetch tesseract@0.0.3
27 silly decomposeActions extract tesseract@0.0.3
28 silly decomposeActions preinstall tesseract@0.0.3
29 silly decomposeActions build tesseract@0.0.3
30 silly decomposeActions install tesseract@0.0.3
31 silly decomposeActions postinstall tesseract@0.0.3
32 silly decomposeActions finalize tesseract@0.0.3
33 silly decomposeActions refresh-package-json tesseract@0.0.3
34 silly install executeActions
35 silly doSerial global-install 8
36 verbose correctMkdir C:\Users\andre\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
37 verbose lock using C:\Users\andre\AppData\Roaming\npm-cache\_locks\staging-3abc070f8384e01a.lock for C:\WINDOWS\system32\node_modules\.staging
38 silly doParallel extract 1
39 silly extract tesseract@0.0.3
40 silly tarball trying tesseract@latest by hash: sha1-/0udBb/uDZDT2TRQ6MZgaVT/Niw=
41 silly extract tesseract@latest extracted to C:\WINDOWS\system32\node_modules\.staging\tesseract-314a17f0 (25ms)
42 timing action:extract Completed in 26ms
43 silly doReverseSerial unbuild 8
44 silly doSerial remove 8
45 silly doSerial move 8
46 silly doSerial finalize 8
47 silly finalize C:\WINDOWS\system32\node_modules\tesseract
48 timing action:finalize Completed in 4ms
49 silly doParallel refresh-package-json 1
50 silly refresh-package-json C:\WINDOWS\system32\node_modules\tesseract
51 timing action:refresh-package-json Completed in 14ms
52 silly doParallel preinstall 1
53 silly preinstall tesseract@0.0.3
54 info lifecycle tesseract@0.0.3~preinstall: tesseract@0.0.3
55 timing action:preinstall Completed in 1ms
56 silly doSerial build 8
57 silly build tesseract@0.0.3
58 info linkStuff tesseract@0.0.3
59 silly linkStuff tesseract@0.0.3 has C:\WINDOWS\system32\node_modules as its parent node_modules
60 timing action:build Completed in 1ms
61 silly doSerial global-link 8
62 silly doParallel update-linked 0
63 silly doSerial install 8
64 silly install tesseract@0.0.3
65 info lifecycle tesseract@0.0.3~install: tesseract@0.0.3
66 verbose lifecycle tesseract@0.0.3~install: unsafe-perm in lifecycle true
67 verbose lifecycle tesseract@0.0.3~install: PATH: C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\WINDOWS\system32\node_modules\tesseract\node_modules\.bin;C:\WINDOWS\system32\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC0\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\DTS\Binn\;C:\Program Files (x86)\Windows Kits.1\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\PuTTY\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\nodejs\;C:\Users\andre\.windows-build-tools\python27\;C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\andre\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Users\andre\AppData\Roaming\npm\node_modules\.bin;C:\Users\andre\AppData\Local\Microsoft\WindowsApps;C:\Program Files\heroku\bin;C:\Python27;C:\Python27\Scripts;C:\Users\andre\AppData\Local\Yarn\bin;C:\Users\andre\AppData\Roaming\npm
68 verbose lifecycle tesseract@0.0.3~install: CWD: C:\WINDOWS\system32\node_modules\tesseract
69 silly lifecycle tesseract@0.0.3~install: Args: [ '/d /s /c', 'node-gyp rebuild' ]
70 timing audit submit Completed in 310ms
71 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 310ms
72 timing audit body Completed in 1ms
73 silly lifecycle tesseract@0.0.3~install: Returned: code: 1 signal: null
74 info lifecycle tesseract@0.0.3~install: Failed to exec install script
75 timing action:install Completed in 941ms
76 verbose unlock done using C:\Users\andre\AppData\Roaming\npm-cache\_locks\staging-3abc070f8384e01a.lock for C:\WINDOWS\system32\node_modules\.staging
77 timing stage:rollbackFailedOptional Completed in 7ms
78 timing stage:runTopLevelLifecycles Completed in 1358ms
79 silly saveTree system32
79 silly saveTree `-- tesseract@0.0.3
80 warn enoent ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json'
81 verbose enoent This is related to npm not being able to find a file.
82 warn system32 No description
83 warn system32 No repository field.
84 warn system32 No README data
85 warn system32 No license field.
86 verbose stack Error: tesseract@0.0.3 install: `node-gyp rebuild`
86 verbose stack Exit status 1
86 verbose stack at EventEmitter.<anonymous> (C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
86 verbose stack at EventEmitter.emit (events.js:189:13)
86 verbose stack at ChildProcess.<anonymous> (C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
86 verbose stack at ChildProcess.emit (events.js:189:13)
86 verbose stack at maybeClose (internal/child_process.js:970:16)
86 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
87 verbose pkgid tesseract@0.0.3
88 verbose cwd C:\WINDOWS\system32
89 verbose Windows_NT 10.0.17763
90 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\andre\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "i" "-G" "tesseract"
91 verbose node v10.15.3
92 verbose npm v6.8.0
93 error code ELIFECYCLE
94 error errno 1
95 error tesseract@0.0.3 install: `node-gyp rebuild`
95 error Exit status 1
96 error Failed at the tesseract@0.0.3 install script.
96 error This is probably not a problem with npm. There is likely additional logging output above.
97 verbose exit [ 1, true ]
要安装 tesseract.js,您应该键入:
$ npm i tesseract.js # https://www.npmjs.com/package/tesseract.js
而不是
$ npm i tesseract # https://www.npmjs.com/package/tesseract
它们是非常不同的包,后者已经停止维护将近 4 年了。如果您仍然想使用它,请尝试在此处留下问题:https://github.com/7eggs/node-tesseract
无法通过 npm i -G tesseract
Windows10、npm版本6.8.0
错误:
! C:\WINDOWS\system32\node_modules\tesseract>if not defined npm_config_node_gyp (node "C:\Users\andre\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\andre\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) MSBUILD : error MSB1009: file of project not exists. Ключ: build/binding.sln gyp ERR! build error gyp ERR! stack Error:
C:\Program Files (x86)\Microsoft Visual Studio17\BuildTools\MSBuild.0\Bin\MSBuild.exe
failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:189:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Windows_NT 10.0.17763 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\WINDOWS\system32\node_modules\tesseract gyp ERR! node -v v10.15.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json' npm WARN system32 No description npm WARN system32 No repository field. npm WARN system32 No README data npm WARN system32 No license field. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! tesseract@0.0.3 install:node-gyp rebuild
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the tesseract@0.0.3 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\andre\AppData\Roaming\npm-cache_logs19-05-29T21_46_48_037Z-debug.log
日志文件
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\andre\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'i',
1 verbose cli '-G',
1 verbose cli 'tesseract' ]
2 info using npm@6.8.0
3 info using node@v10.15.3
4 verbose npm-session 30233da101cd2793
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/tesseract 315ms (from cache)
8 silly pacote tag manifest for tesseract@latest fetched in 327ms
9 timing stage:loadCurrentTree Completed in 344ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 0ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule tesseract@0.0.3 checking installable status
17 timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 4ms
18 timing stage:loadIdealTree Completed in 6ms
19 silly currentTree system32
20 silly idealTree system32
20 silly idealTree `-- tesseract@0.0.3
21 silly install generateActionsToTake
22 timing stage:generateActionsToTake Completed in 3ms
23 silly diffTrees action count 1
24 silly diffTrees add tesseract@0.0.3
25 silly decomposeActions action count 8
26 silly decomposeActions fetch tesseract@0.0.3
27 silly decomposeActions extract tesseract@0.0.3
28 silly decomposeActions preinstall tesseract@0.0.3
29 silly decomposeActions build tesseract@0.0.3
30 silly decomposeActions install tesseract@0.0.3
31 silly decomposeActions postinstall tesseract@0.0.3
32 silly decomposeActions finalize tesseract@0.0.3
33 silly decomposeActions refresh-package-json tesseract@0.0.3
34 silly install executeActions
35 silly doSerial global-install 8
36 verbose correctMkdir C:\Users\andre\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
37 verbose lock using C:\Users\andre\AppData\Roaming\npm-cache\_locks\staging-3abc070f8384e01a.lock for C:\WINDOWS\system32\node_modules\.staging
38 silly doParallel extract 1
39 silly extract tesseract@0.0.3
40 silly tarball trying tesseract@latest by hash: sha1-/0udBb/uDZDT2TRQ6MZgaVT/Niw=
41 silly extract tesseract@latest extracted to C:\WINDOWS\system32\node_modules\.staging\tesseract-314a17f0 (25ms)
42 timing action:extract Completed in 26ms
43 silly doReverseSerial unbuild 8
44 silly doSerial remove 8
45 silly doSerial move 8
46 silly doSerial finalize 8
47 silly finalize C:\WINDOWS\system32\node_modules\tesseract
48 timing action:finalize Completed in 4ms
49 silly doParallel refresh-package-json 1
50 silly refresh-package-json C:\WINDOWS\system32\node_modules\tesseract
51 timing action:refresh-package-json Completed in 14ms
52 silly doParallel preinstall 1
53 silly preinstall tesseract@0.0.3
54 info lifecycle tesseract@0.0.3~preinstall: tesseract@0.0.3
55 timing action:preinstall Completed in 1ms
56 silly doSerial build 8
57 silly build tesseract@0.0.3
58 info linkStuff tesseract@0.0.3
59 silly linkStuff tesseract@0.0.3 has C:\WINDOWS\system32\node_modules as its parent node_modules
60 timing action:build Completed in 1ms
61 silly doSerial global-link 8
62 silly doParallel update-linked 0
63 silly doSerial install 8
64 silly install tesseract@0.0.3
65 info lifecycle tesseract@0.0.3~install: tesseract@0.0.3
66 verbose lifecycle tesseract@0.0.3~install: unsafe-perm in lifecycle true
67 verbose lifecycle tesseract@0.0.3~install: PATH: C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\WINDOWS\system32\node_modules\tesseract\node_modules\.bin;C:\WINDOWS\system32\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC0\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\DTS\Binn\;C:\Program Files (x86)\Windows Kits.1\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\PuTTY\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\nodejs\;C:\Users\andre\.windows-build-tools\python27\;C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\andre\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Users\andre\AppData\Roaming\npm\node_modules\.bin;C:\Users\andre\AppData\Local\Microsoft\WindowsApps;C:\Program Files\heroku\bin;C:\Python27;C:\Python27\Scripts;C:\Users\andre\AppData\Local\Yarn\bin;C:\Users\andre\AppData\Roaming\npm
68 verbose lifecycle tesseract@0.0.3~install: CWD: C:\WINDOWS\system32\node_modules\tesseract
69 silly lifecycle tesseract@0.0.3~install: Args: [ '/d /s /c', 'node-gyp rebuild' ]
70 timing audit submit Completed in 310ms
71 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 310ms
72 timing audit body Completed in 1ms
73 silly lifecycle tesseract@0.0.3~install: Returned: code: 1 signal: null
74 info lifecycle tesseract@0.0.3~install: Failed to exec install script
75 timing action:install Completed in 941ms
76 verbose unlock done using C:\Users\andre\AppData\Roaming\npm-cache\_locks\staging-3abc070f8384e01a.lock for C:\WINDOWS\system32\node_modules\.staging
77 timing stage:rollbackFailedOptional Completed in 7ms
78 timing stage:runTopLevelLifecycles Completed in 1358ms
79 silly saveTree system32
79 silly saveTree `-- tesseract@0.0.3
80 warn enoent ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json'
81 verbose enoent This is related to npm not being able to find a file.
82 warn system32 No description
83 warn system32 No repository field.
84 warn system32 No README data
85 warn system32 No license field.
86 verbose stack Error: tesseract@0.0.3 install: `node-gyp rebuild`
86 verbose stack Exit status 1
86 verbose stack at EventEmitter.<anonymous> (C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
86 verbose stack at EventEmitter.emit (events.js:189:13)
86 verbose stack at ChildProcess.<anonymous> (C:\Users\andre\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
86 verbose stack at ChildProcess.emit (events.js:189:13)
86 verbose stack at maybeClose (internal/child_process.js:970:16)
86 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
87 verbose pkgid tesseract@0.0.3
88 verbose cwd C:\WINDOWS\system32
89 verbose Windows_NT 10.0.17763
90 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\andre\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "i" "-G" "tesseract"
91 verbose node v10.15.3
92 verbose npm v6.8.0
93 error code ELIFECYCLE
94 error errno 1
95 error tesseract@0.0.3 install: `node-gyp rebuild`
95 error Exit status 1
96 error Failed at the tesseract@0.0.3 install script.
96 error This is probably not a problem with npm. There is likely additional logging output above.
97 verbose exit [ 1, true ]
要安装 tesseract.js,您应该键入:
$ npm i tesseract.js # https://www.npmjs.com/package/tesseract.js
而不是
$ npm i tesseract # https://www.npmjs.com/package/tesseract
它们是非常不同的包,后者已经停止维护将近 4 年了。如果您仍然想使用它,请尝试在此处留下问题:https://github.com/7eggs/node-tesseract