尝试安装'npm quick.db'时Iam出现错误

时间:2020-08-14 19:11:37

标签: node.js discord.js quick.db

我想安装quick.db以与discord.js一起使用,但是在 Windows

上安装npm i quick.db时出错
> 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

1 个答案:

答案 0 :(得分: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