亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

NPM相關(guān)命令之報錯node-gyp...的解決方法

 更新時間:2022年09月05日 13:06:01   作者:班納  
node-gyp就是為node編譯c++擴展的時候使用的編譯工具,下面這篇文章主要給大家介紹了關(guān)于NPM相關(guān)命令之報錯node-gyp...的解決方法,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下

NPM 相關(guān)命令,報錯 node-gyp… 的解決方法

'node-gyp-build' is not recognized as an internal or external command, operable program or batch file.
npm ERR! gyp verb `which` failed Error: not found: python2

相關(guān)的異常信息

> node-gyp-build


                    errorOut='node-gyp-build' is not recognized as an internal or external command,
    operable program or batch file.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! utf-8-validate@5.0.9 install: `node-gyp-build`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the utf-8-validate@5.0.9 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!     D:\app\nodejs\npm-cache\_logs\2022-06-10T00_53_04_766Z-debug.log

                    command='D:\app\nodejs\node.exe' 'D:\app\nvm\v14.7.0\node_modules\npm\bin\npm-cli.js' rebuild utf-8-validate@5.0.9
                    workingDir=
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lx-music-desktop@1.22.0-beta pack:dir: `node build-config/pack.js && electron-builder --dir`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lx-music-desktop@1.22.0-beta pack:dir 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!     D:\app\nodejs\npm-cache\_logs\2022-06-10T00_53_04_842Z-debug.log

通用的解決方案

1. 在線安裝,適合擁有純凈 Windows 開發(fā)環(huán)境的用戶(沒有安裝過 Python, Visual Studio 等…)

# 全局設(shè)置淘寶鏡像(配置過的老鳥可忽略此步驟)
$ npm config set registry https://registry.npm.taobao.org
# 單次使用淘寶鏡像(會使用的老鳥可忽略此步驟)
$ npm install -g node-gyp --registry=https://registry.npm.taobao.org
$ npm install -g --production windows-build-tools --registry=https://registry.npm.taobao.org

2. 手動安裝,針對擁有非純凈 Windows 開發(fā)環(huán)境的老鳥(安裝過 Python, Visual Studio 等…)

重點注意: 等到 Starting installation... 命令字樣出現(xiàn)后,立馬 Ctrl + C 終止后面的安裝過程
!!! 因為我們必須自定義安裝這兩個新環(huán)境,才能不影響我們系統(tǒng)中已安裝的 python 和 vs 等環(huán)境。

巧妙獲取 python2 和 msvs_version 相關(guān)版本的安裝包

$ npm install --global --production windows-build-tools
npm WARN deprecated windows-build-tools@5.2.2: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

> windows-build-tools@5.2.2 postinstall D:\app\nodejs\node_global\node_modules\windows-build-tools
> node ./dist/index.js

Downloading python-2.7.15.amd64.msi
[============================================>] 100.0% of 20.2 MB (9 MB/s)
Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\cpw\.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
[============================================>] 100.0% of 1.12 MB (1.12 MB/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\cpw\.windows-build-tools\vs_BuildTools.exe.

Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

Status from the installers:
---------- Visual Studio Build Tools ----------
Still waiting for installer log file...
------------------- Python --------------------
Still waiting for installer log file...^C

手動安裝 python2 和 msvs_version 到自定義目錄

# 靜默安裝 python2 到指定的目錄
Microsoft Windows [版本 10.0.19044.1706]
(c) Microsoft Corporation。保留所有權(quán)利。

C:\Users\cpw\.windows-build-tools>msiexec /a C:\Users\cpw\.windows-build-tools\python-2.7.15.amd64.msi /quiet TargetDir="C:/app/pvm/v2.7.15"
# 靜默安裝 vs_BuildTools 到默認的目錄
C:\Users\cpw\.windows-build-tools>vs_BuildTools.exe /quiet PrependPath=0 Include_launcher=0 Include_test=0 Include_tcltk=0 Shortcuts=0

全局設(shè)置 python2 和 msvs_version 環(huán)境變量

# 全局設(shè)置 python2 環(huán)境變量
$ npm config set python2 "C:\Python27\python.exe"
# 全局設(shè)置 buildTools 環(huán)境變量
$ npm config set msvs_version "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"

查看 NPM 全局配置

$ npm config list -g
; cli configs
global = true
metrics-registry = "https://registry.npm.taobao.org/"
scope = ""
user-agent = "npm/6.14.13 node/v14.17.0 win32 x64"

; userconfig C:\Users\cpw\.npmrc
CHROMEDRIVER_CDNURL = "https://npm.taobao.org/mirrors/chromedriver"
ELECTRON_BUILDER_BINARIES_MIRROR = "https://npm.taobao.org/mirrors/electron-builder-binaries/"
ELECTRON_MIRROR = "https://npm.taobao.org/mirrors/electron/"
NVM_NODEJS_ORG_MIRROR = "https://npm.taobao.org/mirrors/node"
OPERADRIVER = "https://npm.taobao.org/mirrors/operadriver"
PYTHON_MIRROR = "https://npm.taobao.org/mirrors/python"
cache = "D:\\app\\nodejs\\npm-cache"
chromedriver_cdnurl = "https://npm.taobao.org/mirrors/chromedriver"
electron-builder-binaries_mirror = "https://npm.taobao.org/mirrors/electron-builder-binaries/"
electron_mirror = "https://npm.taobao.org/mirrors/electron/"
msvs_version = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools"
node_sqlite3_binary_host_mirror = "http://npm.taobao.org/mirrors"
phantomjs_cdnurl = "https://npm.taobao.org/mirrors/phantomjs"
prefix = "D:\\app\\nodejs\\node_global"
python = "?D:\\app\\pvm\\v2.7.15\\python.exe"
registry = "https://registry.npm.taobao.org/"
sass_binary_site = "https://npm.taobao.org/mirrors/node-sass/"
strict-ssl = false

; node bin location = D:\app\nodejs\node.exe
; cwd = D:\code\NodejsProjects\lx-music-desktop
; HOME = C:\Users\cpw
; "npm config ls -l" to show all defaults.

總結(jié)

到此這篇關(guān)于NPM相關(guān)命令之報錯node-gyp...解決的文章就介紹到這了,更多相關(guān)NPM報錯node-gyp...解決內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Node.js利用debug模塊打印出調(diào)試日志的方法

    Node.js利用debug模塊打印出調(diào)試日志的方法

    debug日志打印模塊主要實現(xiàn)功能是帶命名空間(模塊名)、時間戳、色彩輸出日志;將日志寫入文件;瀏覽器端使用;格式化函數(shù);支持自定義方法。下面這篇文章主要介紹了Node.js利用debug模塊打印出調(diào)試日志的方法,需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-04-04
  • koa2上傳文件及https配置實現(xiàn)教程

    koa2上傳文件及https配置實現(xiàn)教程

    這篇文章主要為大家介紹了koa2上傳文件及https配置實現(xiàn)教程詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-06-06
  • 詳細談?wù)凬odeJS進程是如何退出的

    詳細談?wù)凬odeJS進程是如何退出的

    這篇文章主要給大家介紹了關(guān)于NodeJS進程是如何退出的相關(guān)資料,主要介紹了導(dǎo)致進程退出的三個因素:主動退出;未捕獲的異常、未處理的 promise rejection;未處理的 Event Emitter error 事件 系統(tǒng)信號,需要的朋友可以參考下
    2021-07-07
  • package.json的版本號更新優(yōu)化方法

    package.json的版本號更新優(yōu)化方法

    這篇文章主要為大家介紹了package.json的版本號更新優(yōu)化方法詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-04-04
  • Node.js中使用mongoose操作mongodb數(shù)據(jù)庫的方法

    Node.js中使用mongoose操作mongodb數(shù)據(jù)庫的方法

    如何利用mongoose將數(shù)據(jù)寫入mongodb數(shù)據(jù)庫呢?操作方法很簡單,下面小編給大家分享Node.js中使用mongoose操作mongodb數(shù)據(jù)庫的方法,感興趣的朋友一起看看吧
    2017-09-09
  • node.js中的fs.chmodSync方法使用說明

    node.js中的fs.chmodSync方法使用說明

    這篇文章主要介紹了node.js中的fs.chmodSync方法使用說明,本文介紹了fs.chmodSync方法說明、語法、接收參數(shù)、使用實例和實現(xiàn)源碼,需要的朋友可以參考下
    2014-12-12
  • node.js核心模塊有哪些

    node.js核心模塊有哪些

    這篇文章主要介紹了node.js核心模塊有哪些,對node.js感興趣的同學(xué),可以參考下
    2021-04-04
  • 使用express+multer實現(xiàn)node中的圖片上傳功能

    使用express+multer實現(xiàn)node中的圖片上傳功能

    這篇文章主要介紹了使用express+multer實現(xiàn)node中的圖片上傳功能,需要的朋友可以參考下
    2018-02-02
  • Node.js API詳解之 tty功能與用法實例分析

    Node.js API詳解之 tty功能與用法實例分析

    這篇文章主要介紹了Node.js API詳解之 tty功能與用法,結(jié)合實例形式分析了Node.js API中tty的基本功能、用法及終端操作相關(guān)使用技巧,需要的朋友可以參考下
    2020-04-04
  • 如何在Nestjs和Vue3中使用socket.io示例詳解

    如何在Nestjs和Vue3中使用socket.io示例詳解

    這篇文章主要為大家介紹了如何在Nestjs和Vue3中使用socket.io示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-08-08

最新評論