vue3.x项目在其他电脑上安装依赖没问题在我电脑上安装依赖报错,node版本和其他未报错的版本一致
warning Error running install script for optional dependency: "D:\workspace\merchant-maintenance-repair\node_modules\speaker: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: D:\workspace\merchant-maintenance-repair\node_modules\speaker
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@14.17.0 | win32 | x64
gyp info find Python using Python version 3.9.1 found at \"C:\Users\gcy\AppData\Local\Programs\Python\Python39-32\python.exe\"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the \"Desktop development with C++\" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/nod...
gyp ERR! find VS
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:75:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:71:14
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:384:16
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:326:5)
gyp ERR! stack at ChildProcess.emit (events.js:376:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1055:16)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command \"C:\\Program Files\\nodejs\\node.exe\" \"C:\\Users\\gcy\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\node-gyp\\bin\\node-gyp.js\" \"rebuild\"
gyp ERR! cwd D:\workspace\merchant-maintenance-repair\node_modules\speaker
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok"
[-/6] ⠈ waiting...
warning Error running install script for optional dependency: "D:\workspace\merchant-maintenance-repair\node_modules\av\node_modules\speaker: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: D:\workspace\merchant-maintenance-repair\node_modules\av\node_modules\speaker
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@14.17.0 | win32 | x64
gyp info find Python using Python version 3.9.1 found at \"C:\Users\gcy\AppData\Local\Programs\Python\Python39-32\python.exe\"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the \"Desktop development with C++\" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/nod...
gyp ERR! find VS
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:75:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:71:14
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\find-visualstudio.js:384:16
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Users\gcy\AppData\Local\Yarn\Data\global\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:326:5)
gyp ERR! stack at ChildProcess.emit (events.js:376:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1055:16)
gyp ERR! System Windows_NT 10.0.19042
[-/6] ⡀ waiting...
[-/6] ⡀ waiting...
[6/6] ⡀ node-sass
[-/6] ⡀ waiting...
error D:\workspace\merchant-maintenance-repair\node_modules\node-sass: Command failed.
Exit code: 1ing...
Command: node scripts/build.js
Arguments:
Directory: D:\workspace\merchant-maintenance-repair\node_modules\node-sass
Output:
Building: C:\Program Files\nodejs\node.exe D:\workspace\merchant-maintenance-repair\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli 'C:\Program Files\nodejs\node.exe',
gyp verb cli 'D:\workspace\merchant-maintenance-repair\node_modules\node-gyp\bin\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@14.17.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which
failed Error: not found: python2
gyp verb which
failed at getNotFoundError (D:\workspace\merchant-maintenance-repair\node_modules\which\which.js:13:12)
gyp verb which
failed at F (D:\workspace\merchant-maintenance-repair\node_modules\which\which.js:68:19)
gyp verb which
failed at E (D:\workspace\merchant-maintenance-repair\node_modules\which\which.js:80:29)
gyp verb which
failed at D:\workspace\merchant-maintenance-repair\node_modules\which\which.js:89:16
gyp verb which
failed at D:\workspace\merchant-maintenance-repair\node_modules\isexe\index.js:42:5
gyp verb which
failed at D:\workspace\merchant-maintenance-repair\node_modules\isexe\windows.js:36:5
gyp verb which
failed at FSReqCallback.oncomplete (fs.js:192:21)
gyp verb which
failed python2 Error: not found: python2
gyp verb which
failed at getNotFoundError (D:\workspace\merchant-maintenance-repair\node_modules\which\which.js:13:12)
gyp verb which
failed at F (D:\workspace\merchant-maintenance-repair\node_modules\which\which.js:68:19)
gyp verb which
failed at E (D:\workspace\merchant-maintenance-repair\node_modules\which\which.js:80:29)
gyp verb which
failed at D:\workspace\merchant-maintenance-repair\node_modules\which\which.js:89:16
gyp verb which
failed at D:\workspace\merchant-maintenance-repair\node_modules\isexe\index.js:42:5
gyp verb which
failed at D:\workspace\merchant-maintenance-repair\node_modules\isexe\windows.js:36:5
gyp verb which
failed at FSReqCallback.oncomplete (fs.js:192:21) {
gyp verb which
failed code: 'ENOENT'
gyp verb which
failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb which
succeeded python C:\Users\gcy\AppData\Local\Programs\Python\Python39-32\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\gcy\AppData\Local\Programs\Python\Python39-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:319:12)
gyp ERR! stack at ChildProcess.emit (events.js:376:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1055:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\workspace\merchant-maintenance-repair\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\workspace\merchant-maintenance-repair\node_modules\node-sass
gyp ERR! node -v v14.17.0
回答:
node-sass 里面会用到 node-gyp 这个玩意
一般情况下报错这个就是node 版本 跟node-sass 不匹配造成的,所以你去看看你依赖里面 node-sass 的版本,是否符合要求,有時候大版本对应没有问题的话,在尝试小版本的去适应,基本都能解决,之前我也遇到过,即使设置跟同事一样的node 也不行,后来还是切换node版本才解决的
回答:
参照官方readme来操作
https://github.com/nodejs/nod...
https://github.com/Microsoft/...
so try
npm install -g windows-build-tools
以上是 vue3.x项目在其他电脑上安装依赖没问题在我电脑上安装依赖报错,node版本和其他未报错的版本一致 的全部内容, 来源链接: utcz.com/p/937077.html