Skip to content

想请问一下环境是什么,安装依赖报错 #23

@lushi78778

Description

@lushi78778

我的环境

PS D:\projectCode\html\Bing-wallpaper> node -v
v20.10.0
PS D:\projectCode\html\Bing-wallpaper> yarn -v
1.22.21
PS D:\projectCode\html\Bing-wallpaper> python -V
Python 2.7.13

报错
···bash
yarn install v1.22.21
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@zeit/next-sass > sass-loader@6.0.6" has unmet peer dependency "webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0".
warning "@zeit/next-sass > @zeit/next-css > css-loader@1.0.0" has unmet peer dependency "webpack@^4.0.0".
warning "@zeit/next-sass > @zeit/next-css > mini-css-extract-plugin@0.4.3" has unmet peer dependency "webpack@^4.4.0".
warning "antd > @ant-design/icons@4.2.2" has incorrect peer dependency
"react@16.x".
warning "antd > @ant-design/react-slick@0.27.11" has incorrect peer dependency "react@^0.14.0 || ^15.0.1 || ^16.0.0".
warning "antd > @ant-design/react-slick@0.27.11" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.1 || ^16.0.0".
warning "antd > rc-field-form@1.13.0" has incorrect peer dependency "react@^16.9.0".
warning "antd > rc-image@3.2.2" has incorrect peer dependency "react@^16.8.0".
warning "antd > rc-image@3.2.2" has incorrect peer dependency "react-dom@^16.8.0".
warning " > next@9.5.5" has incorrect peer dependency "react@^16.6.0".
warning " > next@9.5.5" has incorrect peer dependency "react-dom@^16.6.0".
warning "next > @next/react-dev-overlay@9.5.5" has incorrect peer dependency "react@^16.9.0".
warning "next > @next/react-dev-overlay@9.5.5" has incorrect peer dependency "react-dom@^16.9.0".
warning "next > styled-jsx@3.3.0" has incorrect peer dependency "react@15.x.x || 16.x.x".
warning "next > use-subscription@1.4.1" has incorrect peer dependency "react@^16.8.0".
[4/4] Building fresh packages...
[1/2] ⠄ node-sass
error D:\projectCode\html\Bing-wallpaper\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: D:\projectCode\html\Bing-wallpaper\node_modules\node-sass
Output:
Building: D:\code-tool-env\nodejs\node.exe D:\projectCode\html\Bing-wallpaper\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 'D:\code-tool-env\nodejs\node.exe',
gyp verb cli 'D:\projectCode\html\Bing-wallpaper\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@20.10.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 succeeded python2 D:\code-tool-env\pyhhon\python2.EXE
gyp verb check python version D:\code-tool-env\pyhhon\python2.EXE -c "import sys; print "2.7.13 gyp verb check python version .%s.%s" % sys.version_info[:3];" returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 20.10.0
gyp verb command install [ '20.10.0' ]
gyp verb install input version string "20.10.0"
gyp verb install installing version: 20.10.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 20.10.0
gyp verb build dir attempting to create "build" dir: D:\projectCode\html\Bing-wallpaper\node_modules\node-sass\build
gyp verb build dir "build" dir needed to be created? D:\projectCode\html\Bing-wallpaper\node_modules\node-sass\build
gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64
gyp verb find vs2017 - Found Microsoft.VisualStudio.VC.MSBuild.Base
gyp verb find vs2017 - Missing a Windows SDK (Microsoft.VisualStudio.Component.Windows10SDK.* or Microsoft.VisualStudio.Component.Windows81SDK)
gyp verb find vs2017 - Some required components are missing, not using this installation
gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
gyp verb find vs2017 - Missing Visual Studio C++ core features (Microsoft.VisualStudio.VC.MSBuild.Base)
gyp verb find vs2017 - Missing VC++ 2017 v141 toolset (x86,x64) (Microsoft.VisualStudio.Component.VC.Tools.x86.x64)
gyp verb find vs2017 - Missing a Windows SDK (Microsoft.VisualStudio.Component.Windows10SDK.* or Microsoft.VisualStudio.Component.Windows81SDK)
gyp verb find vs2017 - Some required components are missing, not using this installation
gyp verb Not using VS2017: No usable installation of VS2017 found
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: D:\projectCode\html\Bing-wallpaper\node_modules\node-sass\build\config.gypi
gyp verb config.gypi checking for gypi file: D:\projectCode\html\Bing-wallpaper\node_modules\node-sass\config.gypi
gyp verb common.gypi checking for gypi file: D:\projectCode\html\Bing-wallpaper\node_modules\node-sass\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn D:\code-tool-env\pyhhon\python2.EXE
gyp info spawn args [
gyp info spawn args 'D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'D:\projectCode\html\Bing-wallpaper\node_modules\node-sass\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\lushi\.node-gyp\20.10.0\include\node\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\lushi\.node-gyp\20.10.0',
gyp info spawn args '-Dnode_gyp_dir=D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\Users\lushi\.node-gyp\20.10.0\<(target_arch)\node.lib',
gyp info spawn args '-Dmodule_root_dir=D:\projectCode\html\Bing-wallpaper\node_modules\node-sass',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'D:\projectCode\html\Bing-wallpaper\node_modules\node-sass\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\gyp_main.py", line 16, in
sys.exit(gyp.script_main())
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 545, in script_main
return main(sys.argv[1:])
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 538, in main
return gyp_main(args)
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 514, in gyp_main
options.duplicate_basename_check)
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 130, in Load
params['parallel'], params['root_targets'])
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 2783, in Load
variables, includes, depth, check, True)
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 399, in LoadTargetBuildFile
includes, True, check)
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 271, in LoadOneBuildFile
aux_data, includes, check)
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 308, in LoadBuildFileIncludesIntoDict
LoadOneBuildFile(include, data, aux_data, None, False, check),
File "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 251, in LoadOneBuildFile
None)
File "C:\Users\lushi.node-gyp\20.10.0\include\node\common.gypi", line 1
nerate ',
^
SyntaxError: EOL while scanning string literal
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (node:events:514:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Windows_NT 10.0.19045
gyp ERR! command "D:\code-tool-env\nodejs\node.exe" "D:\projectCode\html\Bing-wallpaper\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\projectCode\html\Bing-wallpaper\node_modules\node-sass
gyp ERR! node -v v20.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation ab

···

我暂时无法解决
我了解到的好像是:与 node-sass 和 node-gyp 相关,是构建过程中的配置问题。
我搜到了解决方法

  • Python 版本: 确保你已经安装了 Python 2.x。似乎它正在寻找 Python2,确保环境变量中的 Python 路径设置正确。(我已安装)

  • Windows 构建工具: 由于你在 Windows 上,确保已经安装了必需的构建工具。你可以使用以下命令安装:

npm install --global windows-build-tools
(会报错)
我想请问一下您的构建环境

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions