timing command :install Completed in 211449ms 6457 verbose stack Error: command failed 6457 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27) 6457 verbose stack at ChildProcess.emit (node:events:526:28) 6457 verbose stack at maybeClose (node:internal/child_process:1092:16) 6457 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) 6458 verbose pkgid fibers@5.0.3 6459 verbose cwd C:\Users\itw_huangkui\Desktop\jyz4.0\comp-web 6460 verbose Windows_NT 10.0.17763 6461 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 6462 verbose node v16.14.2 6463 verbose npm v8.5.0 6464 error code 1 6465 error path C:\Users\itw_huangkui\Desktop\jyz4.0\comp-web\node_modules\fibers 6466 error command failed 6467 error command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild 6468 error gyp info it worked if it ends with ok 6468 error gyp info using node-gyp@8.4.1 6468 error gyp info using node@16.14.2 | win32 | x64 6468 error gyp ERR! find Python 6468 error gyp ERR! find Python Python is not set from command line or npm configuration 6468 error gyp ERR! find Python Python is not set from environment variable PYTHON 6468 error gyp ERR! find Python checking if "python3" can be used 6468 error gyp ERR! find Python - "python3" is not in PATH or produced an error 6468 error gyp ERR! find Python checking if "python" can be used 6468 error gyp ERR! find Python - "python" is not in PATH or produced an error 6468 error gyp ERR! find Python checking if Python is C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python39\python.exe 6468 error gyp ERR! find Python - "C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python39\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe 6468 error gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python39-32\python.exe 6468 error gyp ERR! find Python - "C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe 6468 error gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe 6468 error gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python38\python.exe 6468 error gyp ERR! find Python - "C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python38\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe 6468 error gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python38-32\python.exe 6468 error gyp ERR! find Python - "C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe 6468 error gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe 6468 error gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python37\python.exe 6468 error gyp ERR! find Python - "C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python37\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe 6468 error gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python37-32\python.exe 6468 error gyp ERR! find Python - "C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python37-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe 6468 error gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe 6468 error gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python36\python.exe 6468 error gyp ERR! find Python - "C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python36\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C :\Program Files\Python36\python.exe 6468 error gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python36-32\python.exe 6468 error gyp ERR! find Python - "C:\Users\itw_huangkui\AppData\Local\Programs\Python\Python36-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe 6468 error gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe 6468 error gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be run 6468 error gyp ERR! find Python checking if the py launcher can be used to find Python 3 6468 error gyp ERR! find Python - "py.exe" is not in PATH or produced an error 6468 error gyp ERR! find Python 6468 error gyp ERR! find Python ********************************************************** 6468 error gyp ERR! find Python You need to install the latest version of Python. 6468 error gyp ERR! find Python Node-gyp should be able to find and use Python. If not, 6468 error gyp ERR! find Python you can try one of the following options: 6468 error gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe" 6468 error gyp ERR! find Python (accepted by both node-gyp and npm) 6468 error gyp ERR! find Python - Set the environment variable PYTHON 6468 error gyp ERR! find Python - Set the npm configuration variable python: 6468 error gyp ERR! find Python npm config set python "C:\Path\To\python.exe" 6468 error gyp ERR! find Python For more information consult the documentation at: 6468 error gyp ERR! find Python https://github.com/nodejs/node-gyp#installation 6468 error gyp ERR! find Python ********************************************************** 6468 error gyp ERR! find Python 6468 error gyp ERR! configure error 6468 error gyp ERR! stack Error: Could not find any Python installation to use 6468 error gyp ERR! stack at PythonFinder.fail (C:\Users\itw_huangkui\Desktop\jyz4.0\comp-web\node_modules\node-gyp\lib\find-python.js:330:47) 6468 error gyp ERR! stack at PythonFinder.runChecks (C:\Users\itw_huangkui\Desktop\jyz4.0\comp-web\node_modules\node-gyp\lib\find-python.js:159:21) 6468 error gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\itw_huangkui\Desktop\jyz4.0\comp-web\node_modules\node-gyp\lib\find-python.js:228:18) 6468 error gyp ERR! stack at PythonFinder.execFileCallback (C:\Users\itw_huangkui\Desktop\jyz4.0\comp-web\node_modules\node-gyp\lib\find-python.js:294:16) 6468 error gyp ERR! stack at exithandler (node:child_process:406:5) 6468 error gyp ERR! stack at ChildProcess.errorhandler (node:child_process:418:5) 6468 error gyp ERR! stack at ChildProcess.emit (node:events:526:28) 6468 error gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12) 6468 error gyp ERR! stack at onErrorNT (node:internal/child_process:478:16) 6468 error gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21) 6468 error gyp ERR! System Windows_NT 10.0.17763 6468 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\itw_huangkui\\Desktop\\jyz4.0\\comp-web\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" 6468 error gyp ERR! cwd C:\Users\itw_huangkui\Desktop\jyz4.0\comp-web\node_modules\fibers 6468 error gyp ERR! node -v v16.14.2 6468 error gyp ERR! node-gyp -v v8.4.1 6468 error gyp ERR! not ok 6469 verbose exit 1 6470 timing npm Completed in 212266ms 6471 verbose unfinished npm timer reify 1662344574295 6472 verbose unfinished npm timer reify:build 1662344752010 6473 verbose unfinished npm timer build 1662344752018 6474 verbose unfinished npm timer build:deps 1662344752020 6475 verbose unfinished npm timer build:run:install 1662344752861 6476 verbose unfinished npm timer build:run:install:node_modules/bufferutil 1662344752861 6477 verbose unfinished npm timer build:run:install:node_modules/fibers 1662344753161 6478 verbose unfinished npm timer build:run:install:node_modules/node-sass 1662344753173 6479 verbose unfinished npm timer build:run:install:node_modules/utf-8-validate 1662344753190 6480 verbose code 1

安装之后直接一大堆抛错,容易瞬间懵逼。 第一直觉,么有思路,百度之。。。。

百度初步结果

  • 安装python2.7
  • 安装window-build-tools
  • 说明:安装python等已经是很老的方案了,window-build-tools也在高版本的node包中包含了,无需安装的。

    实际问题及方案

  • node 与 node-sass 版本不匹配
  • node和 node-sass是有版本关系的:

    Below is a quick guide for minimum and maximum supported versions of node-sass:
    NodeJS  | Supported node-sass version | Node Module
    --------|-----------------------------|------------
    Node 17 | 7.0+                        | 102
    Node 16 | 6.0+                        | 93
    Node 15 | 5.0+, <7.0                 | 88
    Node 14 | 4.14+                       | 83
    Node 13 | 4.13+, <5.0                 | 79
    Node 12 | 4.12+                       | 72
    Node 11 | 4.10+, <5.0                 | 67
    Node 10 | 4.9+, <6.0                  | 64
    Node 8  | 4.5.3+, <5.0                | 57
    Node <8 | <5.0                        | <57
    

    可以先查看下,本身的node版本和node-sass版本是否匹配,如果不匹配,要么升降node版本,要么升级node-sass. 2.如果问题一解决后,可能还会存在无法安装的问题。这个时候,一般是npm源的问题。

    npm config get registry  //获取npm源
    

    当你是外网时,可以直接使用淘宝源,或者直接指定node-sass的源地址:

    npm config set registry https://registry.npmmirror.com/
    npm config set sass-binary-site http://npm.taobao.org/mirrors/node-sass
    

    推荐使用nrm进行npm源管理

    如果你是内网: 项目根目录,创建.npmrc配置文件,在配置文件中设置node-sass下载地址。 下载方法:

  • 进入淘宝源 node-sass页面: registry.npmmirror.com/binary.html…
  • 选择个人需要的版本
  • 这里的选择,需要和 node版本相匹配,

    请注意:上图中圈中的为 Node Module 的版本

  • .npmrc 中文件内容如下:
  • SASS_BINARY_PATH=C:/Node/cache/node-sass/7.0.1/win32-x64-93_binding.node

    此处路径为个人设定,可随意修改。

    整个node_modules 文件夹从可用人员那里拷贝之

    分类:
    前端
    标签: