无法在 Nestjs 项目中安装节点模块

时间:2021-03-09 09:23:06

标签: node.js npm installation nestjs

我从 github 克隆了一个 nest.js 应用程序。我正在尝试安装节点模块,但是当我尝试运行注释 npm install 时,应用程序出错。

npm WARN tar TAR_ENTRY_ERROR EPERM: operation not permitted, unlink 'D:\ThesisArtValueMyCode\Clone_art_values_api\node_modules\moment\locale\en-SG.js.DELETE.4db65193375d77bd6793cd19a8c5da63'
npm ERR! code 1
npm ERR! path D:\ThesisArtValueMyCode\Clone_art_values_api\node_modules\sha3
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.16.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.8.8 found at "C:\Users\rezau\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2019 (16.8.31005.135) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
npm ERR! gyp ERR! find VS - "Visual Studio C++ core features" missing
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\rezau\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\Users\rezau\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\rezau\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\Users\rezau\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\Users\rezau\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:\Users\rezau\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Users\rezau\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
npm ERR! gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
npm ERR! gyp ERR! System Windows_NT 10.0.18363
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\rezau\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\ThesisArtValueMyCode\Clone_art_values_api\node_modules\sha3
npm ERR! gyp ERR! node -v v12.16.0
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!     C:\Users\rezau\AppData\Local\npm-cache\_logs\2021-03-09T08_49_40_737Z-debug.log

上述错误始终显示。我不明白如何解决这个问题。我更新了我的 npm。

1 个答案:

答案 0 :(得分:0)

您需要安装最新版本的 Visual Studio 并从中安装 Visual Studio C++ 核心功能,然后重试。

下载链接:https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16

<块引用>

您将在安装程序中看到 Visual C++ 构建工具选项,只需选择它并安装默认组件,您将不需要可选组件,因为我这样做只需忽略右侧打勾的功能.

image showing installation components needed

希望这会有所帮助,请不要介意糟糕的素描技巧!

相关问题