尝试安装“npm quick.db”时出现错误

Posted

技术标签:

【中文标题】尝试安装“npm quick.db”时出现错误【英文标题】:Iam getting error when trying to install 'npm quick.db' 【发布时间】:2020-12-04 16:44:27 【问题描述】:

我想安装 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

【问题讨论】:

也许这可以通过写npm i -g windows-build-tools来解决。我不是 Windows 用户,但我知道它已经解决了某些用户的问题 我安装了,但还是不行,还是谢谢 【参考方案1】:

确保您使用的是 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

【讨论】:

以上是关于尝试安装“npm quick.db”时出现错误的主要内容,如果未能解决你的问题,请参考以下文章

尝试安装 LESS 时出现“请以 Root/Administrator 身份再次尝试运行此命令”错误

安装 NuxtJs 时出现错误

安装 cocoapods 时出现 gem 本机扩展错误

安装mlpy时出现gsl错误[关闭]

尝试使用“pip install psycopg2”在 Mac 上安装 psycopg2 时出现权限错误

安装 gevent 时出现 Libev 相关错误