npm install jsdom -g 安装失败

发布于 2022-09-13 00:47:33 字数 8092 浏览 15 评论 0

C:\Users\Administrator>npm install jsdom -g
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup undefined,
npm WARN cleanup AssertionError [ERR_ASSERTION]: rimraf: missing path
npm WARN cleanup at rimraf (D:\nodejs\node_global\node_modules\npm\node_
modules\rimraf\rimraf.js:54:3)
npm WARN cleanup at internal/util.js:297:30
npm WARN cleanup at new Promise (<anonymous>)
npm WARN cleanup at rimraf (internal/util.js:296:12)
npm WARN cleanup at D:\nodejs\node_global\node_modules\npm\node_modules\
@npmcli\arborist\lib\arborist\reify.js:449:20
npm WARN cleanup at Array.map (<anonymous>)
npm WARN cleanup at Arborist.[rollbackCreateSparseTree] (D:\nodejs\node_
global\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:449:
8)
npm WARN cleanup at D:\nodejs\node_global\node_modules\npm\node_modules\
@npmcli\arborist\lib\arborist\reify.js:868:50
npm WARN cleanup at processTicksAndRejections (internal/process/task_que
ues.js:97:5)
npm WARN cleanup at async Arborist.[reifyPackages] (D:\nodejs\node_globa
l\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:210:11) {

npm WARN cleanup generatedMessage: false,
npm WARN cleanup code: 'ERR_ASSERTION',
npm WARN cleanup actual: undefined,
npm WARN cleanup expected: true,
npm WARN cleanup operator: '=='
npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path D:\nodejs\node_global\node_modules\canvas
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@12.18.3 | win32 | ia32
npm ERR! gyp info find Python using Python version 3.7.4 found at "C:\Users\Admi
nistrator\AppData\Local\Programs\Python\Python37-32\python.exe"
npm ERR! gyp info find VS using VS2015 (14.0) found at:
npm ERR! gyp info find VS "C:\Program Files\Microsoft Visual Studio 14.0"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\Administrator\AppData\Local\Programs\Python\Pyt
hon37-32\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'D:\nodejs\node_global\node_modules\npm\node
_modules\node-gyp\gyp\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\nodejs\node_global\node_modules\canvas\b
uild\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\nodejs\node_global\node_modules\npm\node
_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Administrator\AppData\Local\node-g
yp\Cache\12.18.3\include\node\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\Administrator\AppDat
a\Local\node-gyp\Cache\12.18.3',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=D:\nodejs\node_global\node_mod
ules\npm\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\Administrator\\
AppData\\Local\\node-gyp\\Cache\\12.18.3\\<(target_arch)\\node.lib',

npm ERR! gyp info spawn args '-Dmodule_root_dir=D:\nodejs\node_global\node_
modules\canvas',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'D:\nodejs\node_global\node_modules\canvas\b
uild',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\gyp_main.py", line 51, in <module>
npm ERR! sys.exit(gyp.script_main())
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\__init__.py", line 670, in script_main
npm ERR! return main(sys.argv[1:])
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\__init__.py", line 662, in main
npm ERR! return gyp_main(args)
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\__init__.py", line 637, in gyp_main
npm ERR! options.circular_check,
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\__init__.py", line 159, in Load
npm ERR! params["root_targets"],
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\input.py", line 3022, in Load
npm ERR! build_file, data, aux_data, variables, includes, depth, check, True

npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\input.py", line 439, in LoadTargetBuildFile
npm ERR! build_file_data, PHASE_EARLY, variables, build_file_path
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\input.py", line 1397, in ProcessVariablesAndConditionsInDict
npm ERR! ProcessConditionsInDict(the_dict, phase, variables, build_file)
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\input.py", line 1269, in ProcessConditionsInDict
npm ERR! merge_dict, phase, variables, build_file
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\input.py", line 1340, in ProcessVariablesAndConditionsInDict
npm ERR! the_dict["variables"], phase, variables, build_file, "variables"
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\input.py", line 1340, in ProcessVariablesAndConditionsInDict
npm ERR! the_dict["variables"], phase, variables, build_file, "variables"
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\input.py", line 1348, in ProcessVariablesAndConditionsInDict
npm ERR! expanded = ExpandVariables(value, phase, variables, build_file)
npm ERR! File "D:\nodejs\node_global\node_modules\npm\node_modules\node-gyp\gy
p\pylib\gyp\input.py", line 991, in ExpandVariables
npm ERR! p_stdout = p_stdout.decode("utf-8")
npm ERR! AttributeError: 'str' object has no attribute 'decode' while trying to
load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (D:\nodejs\node_global\node
_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/chi
ld_process.js:275:12)
npm ERR! gyp ERR! System Windows_NT 6.1.7601
npm ERR! gyp ERR! command "D:\nodejs\node.exe" "D:\nodejs\node_global\node_
modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\nodejs\node_global\node_modules\canvas
npm ERR! gyp ERR! node -v v12.18.3
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache\_logs\2021-07-26T08_53_34_645Z-debug.log

C:\Users\Administrator>

用的是淘宝镜像,电脑操作系统是WIN7-32位,安装其它是没问题的,例如安装:
npm install jsencrypt -g
等等,是成功的。安装canvas、npm也是成功的。目前就发现无法安装jsdom

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

命比纸薄 2022-09-20 00:47:33

用淘宝源或者挂代理安装

北方的巷 2022-09-20 00:47:33

使用cnpm

烟织青萝梦 2022-09-20 00:47:33

题主查看一下自己的node版本,尝试降低至10.x?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文