0

我想安装 quick.db 以使用 discord.js,但npm i quick.dbWindows上安装时出错

> npm i quick.db
integer@3.0.1 install C:\Users\User\server\node_modules\integer
prebuild-install || npm run build-release

prebuild-install WARN install No prebuilt binaries found (target=14.7.0 runtime=node arch=x64 libc= platform=win32)

integer@3.0.1 build-release C:\Users\User\server\node_modules\integer
node-gyp rebuild --release

if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 547, in main
    return gyp_main(args)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2008, in GenerateOutput
    msvs_version)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1843, in _CreateProjectObjects
    guid = _GetGuidOfProject(proj_path, spec)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 910, in _GetGuidOfProject
    guid = guid or MSVSNew.MakeGuid(proj_path)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSNew.py", line 48, in MakeGuid
    d = hashlib.md5((str(seed) + str(name)).encode('utf-8')).hexdigest().upper()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 17: ordinal not in range(128)
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276: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" "--release"
gyp ERR! cwd C:\Users\User\Documents\server\JavaScript\node_modules\integer
gyp ERR! node -v v14.7.0
gyp ERR! node-gyp -v v5.1.1
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! integer@3.0.1 build-release: `node-gyp rebuild --release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the integer@3.0.1 build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-08-14T19_01_29_062Z-debug.log
npm WARN javascript@1.0.0 No description
npm WARN javascript@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! integer@3.0.1 install: `prebuild-install || npm run build-release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the integer@3.0.1 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\User\AppData\Roaming\npm-cache\_logs\2020-08-14T19_01_29_560Z-debug.log
4

1 回答 1

0

确保您使用的是 nodejs v10.20.1 或更高版本

确保您已全局安装 node-gyp,包括其所有依赖项。在 Windows 上,您可能需要手动配置一些东西。

如果您使用的是 Windows,请按照以下步骤操作。按此顺序执行,不要跳过步骤。

  • 安装最新的节点 10 或节点 12。

  • 启动 Admin PowerShell:右键单击开始图标,然后选择 Windows PowerShell (Admin)

  • 安装 vs2015 和 vs2017 库。每行大约需要 5-10 分钟。

npm install --global --production --vs2015 --add-python-to-path windows-build-tools
npm install --global --production --add-python-to-path windows-build-tools node-gyp
  • 在您的项目中,请确保您没有使用旧的构建配置。删除 %USERPROFILE%/.node-gyp 和项目的 node_modules 目录。
  • 正确设置 %USERPROFILE%/.npmrc:
msvs_version=2015
python=python2.7

(其中 %USERPROFILE% 是您的主目录)。

npm i quick.db
于 2020-09-17T13:05:09.220 回答