npm install --save opencv4nodejs
Posted
技术标签:
【中文标题】npm install --save opencv4nodejs【英文标题】: 【发布时间】:2019-05-08 07:44:25 【问题描述】:如果您对更改标题有任何建议,请立即告诉我。
我正在尝试在 node.js 中安装 opencv4nodejs,我已经安装了 Visual Studio 2017、Cmake python 2.7.16 和 python 3.7,因为它是必需的
我以管理员身份打开 CMD 并运行下一个命令
npm init -y
npm install express
在安装 opencv4nodejs 时出现问题,这里是日志文件,我跳过了大部分行,因为它包含很多信息。
错误在最后。
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '--save',
1 verbose cli 'opencv4nodejs'
1 verbose cli ]
2 info using npm@6.9.0
3 info using node@v12.1.0
4 verbose npm-session 0c26eaacfc955eb1
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/opencv4nodejs 828ms (from cache)
8 silly pacote tag manifest for opencv4nodejs@latest fetched in 906ms
9 timing stage:loadCurrentTree Completed in 1328ms
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 125ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule opencv4nodejs@4.15.0 checking installable status
17 http fetch GET 304 https://registry.npmjs.org/nan 469ms (from cache)
18 silly pacote range manifest for nan@^2.12.1 fetched in 500ms
19 silly resolveWithNewModule nan@2.13.2 checking installable status
20 http fetch GET 304 https://registry.npmjs.org/@types%2fnode 782ms (from cache)
21 http fetch GET 304 https://registry.npmjs.org/macro-inferno 813ms (from cache)
22 silly pacote range manifest for @types/node@>6 fetched in 860ms
23 silly resolveWithNewModule @types/node@12.0.0 checking installable status
24 http fetch GET 304 https://registry.npmjs.org/opencv-build 875ms (from cache)
25 http fetch GET 304 https://registry.npmjs.org/native-node-utils 875ms (from cache)
26 silly pacote range manifest for macro-inferno@^0.2.3 fetched in 907ms
27 silly resolveWithNewModule macro-inferno@0.2.3 checking installable status
28 silly pacote range manifest for opencv-build@^0.1.3 fetched in 938ms
29 silly resolveWithNewModule opencv-build@0.1.3 checking installable status
30 silly pacote range manifest for native-node-utils@^0.1.5 fetched in 938ms
31 silly resolveWithNewModule native-node-utils@0.1.5 checking installable status
32 silly pacote range manifest for @types/node@^11.10.5 fetched in 78ms
33 silly resolveWithNewModule @types/node@11.13.10 checking installable status
34 http fetch GET 304 https://registry.npmjs.org/npmlog 187ms (from cache)
35 silly pacote range manifest for npmlog@^4.1.2 fetched in 250ms
36 silly resolveWithNewModule npmlog@4.1.2 checking installable status
37 http fetch GET 304 https://registry.npmjs.org/console-control-strings 437ms (from cache)
38 http fetch GET 304 https://registry.npmjs.org/are-we-there-yet 437ms (from cache)
39 http fetch GET 304 https://registry.npmjs.org/gauge 484ms (from cache)
40 silly pacote range manifest for are-we-there-yet@~1.1.2 fetched in 531ms
41 silly resolveWithNewModule are-we-there-yet@1.1.5 checking installable status
42 silly pacote range manifest for console-control-strings@~1.1.0 fetched in 531ms
43 silly resolveWithNewModule console-control-strings@1.1.0 checking installable status
44 silly pacote range manifest for gauge@~2.7.3 fetched in 547ms
45 silly resolveWithNewModule gauge@2.7.4 checking installable status
46 http fetch GET 304 https://registry.npmjs.org/set-blocking 797ms (from cache)
47 silly pacote range manifest for set-blocking@~2.0.0 fetched in 844ms
48 silly resolveWithNewModule set-blocking@2.0.0 checking installable status
49 http fetch GET 304 https://registry.npmjs.org/readable-stream 312ms (from cache)
50 http fetch GET 304 https://registry.npmjs.org/delegates 328ms (from cache)
51 silly pacote range manifest for delegates@^1.0.0 fetched in 328ms
52 silly resolveWithNewModule delegates@1.0.0 checking installable status
53 silly pacote range manifest for readable-stream@^2.0.6 fetched in 343ms
54 silly resolveWithNewModule readable-stream@2.3.6 checking installable status
55 http fetch GET 304 https://registry.npmjs.org/process-nextick-args 360ms (from cache)
56 http fetch GET 304 https://registry.npmjs.org/core-util-is 422ms (from cache)
57 silly pacote range manifest for process-nextick-args@~2.0.0 fetched in 422ms
58 silly resolveWithNewModule process-nextick-args@2.0.0 checking installable status
59 http fetch GET 304 https://registry.npmjs.org/string_decoder 438ms (from cache)
60 http fetch GET 304 https://registry.npmjs.org/isarray 438ms (from cache)
61 silly pacote range manifest for core-util-is@~1.0.0 fetched in 453ms
62 silly resolveWithNewModule core-util-is@1.0.2 checking installable status
63 silly pacote range manifest for isarray@~1.0.0 fetched in 485ms
64 silly resolveWithNewModule isarray@1.0.0 checking installable status
65 silly pacote range manifest for string_decoder@~1.1.1 fetched in 500ms
66 silly resolveWithNewModule string_decoder@1.1.1 checking installable status
67 http fetch GET 304 https://registry.npmjs.org/util-deprecate 532ms (from cache)
68 silly pacote range manifest for util-deprecate@~1.0.1 fetched in 547ms
69 silly resolveWithNewModule util-deprecate@1.0.2 checking installable status
70 http fetch GET 304 https://registry.npmjs.org/object-assign 734ms (from cache)
71 http fetch GET 304 https://registry.npmjs.org/has-unicode 734ms (from cache)
72 http fetch GET 304 https://registry.npmjs.org/aproba 734ms (from cache)
73 http fetch GET 304 https://registry.npmjs.org/signal-exit 734ms (from cache)
74 http fetch GET 304 https://registry.npmjs.org/string-width 765ms (from cache)
75 silly pacote range manifest for object-assign@^4.1.0 fetched in 797ms
76 silly resolveWithNewModule object-assign@4.1.1 checking installable status
77 silly pacote range manifest for has-unicode@^2.0.0 fetched in 812ms
78 silly resolveWithNewModule has-unicode@2.0.1 checking installable status
79 silly pacote range manifest for aproba@^1.0.3 fetched in 859ms
80 silly resolveWithNewModule aproba@1.2.0 checking installable status
81 silly pacote range manifest for string-width@^1.0.1 fetched in 859ms
82 silly resolveWithNewModule string-width@1.0.2 checking installable status
83 silly pacote range manifest for signal-exit@^3.0.0 fetched in 859ms
84 silly resolveWithNewModule signal-exit@3.0.2 checking installable status
85 http fetch GET 304 https://registry.npmjs.org/strip-ansi 1125ms (from cache)
86 http fetch GET 304 https://registry.npmjs.org/wide-align 1156ms (from cache)
87 silly pacote range manifest for strip-ansi@^3.0.1 fetched in 1156ms
88 silly resolveWithNewModule strip-ansi@3.0.1 checking installable status
89 silly pacote range manifest for wide-align@^1.1.0 fetched in 1250ms
90 silly resolveWithNewModule wide-align@1.1.3 checking installable status
91 http fetch GET 304 https://registry.npmjs.org/is-fullwidth-code-point 219ms (from cache)
92 silly pacote range manifest for is-fullwidth-code-point@^1.0.0 fetched in 250ms
93 silly resolveWithNewModule is-fullwidth-code-point@1.0.0 checking installable status
94 http fetch GET 304 https://registry.npmjs.org/code-point-at 781ms (from cache)
95 silly pacote range manifest for code-point-at@^1.0.0 fetched in 844ms
96 silly resolveWithNewModule code-point-at@1.1.0 checking installable status
97 http fetch GET 304 https://registry.npmjs.org/number-is-nan 610ms (from cache)
98 silly pacote range manifest for number-is-nan@^1.0.0 fetched in 641ms
99 silly resolveWithNewModule number-is-nan@1.0.1 checking installable status
100 http fetch GET 304 https://registry.npmjs.org/ansi-regex 640ms (from cache)
101 silly pacote range manifest for ansi-regex@^2.0.0 fetched in 656ms
102 silly resolveWithNewModule ansi-regex@2.1.1 checking installable status
...
715 info lifecycle delegates@1.0.0~install: delegates@1.0.0
716 silly install has-unicode@2.0.1
717 info lifecycle has-unicode@2.0.1~install: has-unicode@2.0.1
718 silly install isarray@1.0.0
719 info lifecycle isarray@1.0.0~install: isarray@1.0.0
720 silly install nan@2.13.2
721 info lifecycle nan@2.13.2~install: nan@2.13.2
722 silly install number-is-nan@1.0.1
723 info lifecycle number-is-nan@1.0.1~install: number-is-nan@1.0.1
724 silly install is-fullwidth-code-point@1.0.0
725 info lifecycle is-fullwidth-code-point@1.0.0~install: is-fullwidth-code-point@1.0.0
726 silly install object-assign@4.1.1
727 info lifecycle object-assign@4.1.1~install: object-assign@4.1.1
728 silly install @types/node@11.13.10
729 info lifecycle @types/node@11.13.10~install: @types/node@11.13.10
730 silly install process-nextick-args@2.0.0
731 info lifecycle process-nextick-args@2.0.0~install: process-nextick-args@2.0.0
732 silly install set-blocking@2.0.0
733 info lifecycle set-blocking@2.0.0~install: set-blocking@2.0.0
734 silly install signal-exit@3.0.2
735 info lifecycle signal-exit@3.0.2~install: signal-exit@3.0.2
736 silly install string_decoder@1.1.1
737 info lifecycle string_decoder@1.1.1~install: string_decoder@1.1.1
738 silly install strip-ansi@3.0.1
739 info lifecycle strip-ansi@3.0.1~install: strip-ansi@3.0.1
740 silly install string-width@1.0.2
741 info lifecycle string-width@1.0.2~install: string-width@1.0.2
742 silly install util-deprecate@1.0.2
743 info lifecycle util-deprecate@1.0.2~install: util-deprecate@1.0.2
744 silly install readable-stream@2.3.6
745 info lifecycle readable-stream@2.3.6~install: readable-stream@2.3.6
746 silly install are-we-there-yet@1.1.5
747 info lifecycle are-we-there-yet@1.1.5~install: are-we-there-yet@1.1.5
748 silly install wide-align@1.1.3
749 info lifecycle wide-align@1.1.3~install: wide-align@1.1.3
750 silly install gauge@2.7.4
751 info lifecycle gauge@2.7.4~install: gauge@2.7.4
752 silly install npmlog@4.1.2
753 info lifecycle npmlog@4.1.2~install: npmlog@4.1.2
754 silly install @types/node@12.0.0
755 info lifecycle @types/node@12.0.0~install: @types/node@12.0.0
756 silly install macro-inferno@0.2.3
757 info lifecycle macro-inferno@0.2.3~install: macro-inferno@0.2.3
758 silly install native-node-utils@0.1.5
759 info lifecycle native-node-utils@0.1.5~install: native-node-utils@0.1.5
760 silly install opencv-build@0.1.3
761 info lifecycle opencv-build@0.1.3~install: opencv-build@0.1.3
762 verbose lifecycle opencv-build@0.1.3~install: unsafe-perm in lifecycle true
763 verbose lifecycle opencv-build@0.1.3~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\crave\Desktop\ocv\node_modules\opencv-build\node_modules\.bin;C:\Users\crave\Desktop\ocv\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\crave\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\crave\AppData\Local\Programs\Python\Python37\;C:\Users\crave\AppData\Local\Microsoft\WindowsApps;C:\Users\crave\AppData\Roaming\npm;C:\Users\crave\AppData\Local\Programs\Microsoft VS Code Insiders\bin
764 verbose lifecycle opencv-build@0.1.3~install: CWD: C:\Users\crave\Desktop\ocv\node_modules\opencv-build
765 silly lifecycle opencv-build@0.1.3~install: Args: [ '/d /s /c', 'node ./install.js' ]
766 silly lifecycle opencv-build@0.1.3~install: Returned: code: 0 signal: null
767 silly install opencv4nodejs@4.15.0
768 info lifecycle opencv4nodejs@4.15.0~install: opencv4nodejs@4.15.0
769 verbose lifecycle opencv4nodejs@4.15.0~install: unsafe-perm in lifecycle true
770 verbose lifecycle opencv4nodejs@4.15.0~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\crave\Desktop\ocv\node_modules\opencv4nodejs\node_modules\.bin;C:\Users\crave\Desktop\ocv\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\crave\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\crave\AppData\Local\Programs\Python\Python37\;C:\Users\crave\AppData\Local\Microsoft\WindowsApps;C:\Users\crave\AppData\Roaming\npm;C:\Users\crave\AppData\Local\Programs\Microsoft VS Code Insiders\bin
771 verbose lifecycle opencv4nodejs@4.15.0~install: CWD: C:\Users\crave\Desktop\ocv\node_modules\opencv4nodejs
772 silly lifecycle opencv4nodejs@4.15.0~install: Args: [ '/d /s /c', 'node-gyp rebuild' ]
773 silly lifecycle opencv4nodejs@4.15.0~install: Returned: code: 1 signal: null
774 info lifecycle opencv4nodejs@4.15.0~install: Failed to exec install script
775 timing action:install Completed in 2779144ms
776 verbose unlock done using C:\Users\crave\AppData\Roaming\npm-cache\_locks\staging-4d03af6a7be1467b.lock for C:\Users\crave\Desktop\ocv\node_modules\.staging
777 timing stage:rollbackFailedOptional Completed in 5625ms
778 timing stage:runTopLevelLifecycles Completed in 2797707ms
779 silly saveTree ocv@1.0.0
779 silly saveTree +-- express@4.16.4
779 silly saveTree | +-- accepts@1.3.7
779 silly saveTree | | +-- mime-types@2.1.24
779 silly saveTree | | | `-- mime-db@1.40.0
779 silly saveTree | | `-- negotiator@0.6.2
779 silly saveTree | +-- array-flatten@1.1.1
779 silly saveTree | +-- body-parser@1.18.3
779 silly saveTree | | +-- bytes@3.0.0
779 silly saveTree | | +-- content-type@1.0.4
779 silly saveTree | | +-- debug@2.6.9
779 silly saveTree | | | `-- ms@2.0.0
779 silly saveTree | | +-- depd@1.1.2
779 silly saveTree | | +-- http-errors@1.6.3
779 silly saveTree | | | +-- inherits@2.0.3
779 silly saveTree | | | +-- setprototypeof@1.1.0
779 silly saveTree | | | `-- statuses@1.4.0
779 silly saveTree | | +-- iconv-lite@0.4.23
779 silly saveTree | | | `-- safer-buffer@2.1.2
779 silly saveTree | | +-- on-finished@2.3.0
779 silly saveTree | | | `-- ee-first@1.1.1
779 silly saveTree | | +-- qs@6.5.2
779 silly saveTree | | +-- raw-body@2.3.3
779 silly saveTree | | | `-- unpipe@1.0.0
779 silly saveTree | | `-- type-is@1.6.18
779 silly saveTree | | `-- media-typer@0.3.0
779 silly saveTree | +-- content-disposition@0.5.2
779 silly saveTree | +-- content-type@1.0.4
779 silly saveTree | +-- cookie-signature@1.0.6
779 silly saveTree | +-- cookie@0.3.1
779 silly saveTree | +-- debug@2.6.9
779 silly saveTree | +-- depd@1.1.2
779 silly saveTree | +-- encodeurl@1.0.2
779 silly saveTree | +-- escape-html@1.0.3
779 silly saveTree | +-- etag@1.8.1
779 silly saveTree | +-- finalhandler@1.1.1
779 silly saveTree | | `-- parseurl@1.3.3
779 silly saveTree | +-- fresh@0.5.2
779 silly saveTree | +-- merge-descriptors@1.0.1
779 silly saveTree | +-- methods@1.1.2
779 silly saveTree | +-- on-finished@2.3.0
779 silly saveTree | +-- parseurl@1.3.3
779 silly saveTree | +-- path-to-regexp@0.1.7
779 silly saveTree | +-- proxy-addr@2.0.5
779 silly saveTree | | +-- forwarded@0.1.2
779 silly saveTree | | `-- ipaddr.js@1.9.0
779 silly saveTree | +-- qs@6.5.2
779 silly saveTree | +-- range-parser@1.2.0
779 silly saveTree | +-- safe-buffer@5.1.2
779 silly saveTree | +-- send@0.16.2
779 silly saveTree | | +-- destroy@1.0.4
779 silly saveTree | | `-- mime@1.4.1
779 silly saveTree | +-- serve-static@1.13.2
779 silly saveTree | +-- setprototypeof@1.1.0
779 silly saveTree | +-- statuses@1.4.0
779 silly saveTree | +-- type-is@1.6.18
779 silly saveTree | +-- utils-merge@1.0.1
779 silly saveTree | `-- vary@1.1.2
779 silly saveTree `-- opencv4nodejs@4.15.0
779 silly saveTree +-- @types/node@12.0.0
779 silly saveTree +-- macro-inferno@0.2.3
779 silly saveTree | `-- nan@2.13.2
779 silly saveTree +-- nan@2.13.2
779 silly saveTree +-- native-node-utils@0.1.5
779 silly saveTree `-- opencv-build@0.1.3
779 silly saveTree +-- @types/node@11.13.10
779 silly saveTree `-- npmlog@4.1.2
779 silly saveTree +-- are-we-there-yet@1.1.5
779 silly saveTree | +-- delegates@1.0.0
779 silly saveTree | `-- readable-stream@2.3.6
779 silly saveTree | +-- core-util-is@1.0.2
779 silly saveTree | +-- isarray@1.0.0
779 silly saveTree | +-- process-nextick-args@2.0.0
779 silly saveTree | +-- string_decoder@1.1.1
779 silly saveTree | `-- util-deprecate@1.0.2
779 silly saveTree +-- console-control-strings@1.1.0
779 silly saveTree +-- gauge@2.7.4
779 silly saveTree | +-- aproba@1.2.0
779 silly saveTree | +-- has-unicode@2.0.1
779 silly saveTree | +-- object-assign@4.1.1
779 silly saveTree | +-- signal-exit@3.0.2
779 silly saveTree | +-- string-width@1.0.2
779 silly saveTree | | +-- code-point-at@1.1.0
779 silly saveTree | | +-- is-fullwidth-code-point@1.0.0
779 silly saveTree | | | `-- number-is-nan@1.0.1
779 silly saveTree | | `-- strip-ansi@3.0.1
779 silly saveTree | | `-- ansi-regex@2.1.1
779 silly saveTree | +-- strip-ansi@3.0.1
779 silly saveTree | `-- wide-align@1.1.3
779 silly saveTree `-- set-blocking@2.0.0
780 warn ocv@1.0.0 No description
781 warn ocv@1.0.0 No repository field.
782 verbose stack Error: opencv4nodejs@4.15.0 install: `node-gyp rebuild`
782 verbose stack Exit status 1
782 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
782 verbose stack at EventEmitter.emit (events.js:196:13)
782 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
782 verbose stack at ChildProcess.emit (events.js:196:13)
782 verbose stack at maybeClose (internal/child_process.js:1000:16)
782 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
783 verbose pkgid opencv4nodejs@4.15.0
784 verbose cwd C:\Users\crave\Desktop\ocv
785 verbose Windows_NT 10.0.18362
786 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "opencv4nodejs"
787 verbose node v12.1.0
788 verbose npm v6.9.0
789 error code ELIFECYCLE
790 error errno 1
791 error opencv4nodejs@4.15.0 install: `node-gyp rebuild`
791 error Exit status 1
792 error Failed at the opencv4nodejs@4.15.0 install script.
792 error This is probably not a problem with npm. There is likely additional logging output above.
793 verbose exit [ 1, true ]
这里是 CMD 的错误
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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:196:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\crave\Desktop\ocv\node_modules\opencv4nodejs
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN ocv@1.0.0 No description
npm WARN ocv@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv4nodejs@4.15.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv4nodejs@4.15.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\crave\AppData\Roaming\npm-cache\_logs\2019-05-08T07_11_47_395Z-debug.log
【问题讨论】:
【参考方案1】:通过 install_path 尝试,没有空格。 你的路径有空间。 'C:\Program Files\nodejs\node.exe',
【讨论】:
以上是关于npm install --save opencv4nodejs的主要内容,如果未能解决你的问题,请参考以下文章
npm install --save 与 npm install --save-dev 的区别
npm install -save 和npm install -save-dev 给你好看
npm install --save 与 npm install --save-dev 的区别
npm init,npm -y, npm install --save,npm install --save-dev