如何修复node-sass错误以运行React应用程序?

问题描述 投票:0回答:1

我正在尝试使用此代码作为类项目的基础,我从github下载了它:https://github.com/fonov/React-Crypto-Exchange

每当我输入“yarn install”时,它就会开始安装软件包,但随后我收到此错误:

Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: C:\Users\twini\OneDrive\Desktop\React-Crypto-Exchange-master\node_modules\node-sass
Output:
Building: C:\Program Files\nodejs\node.exe C:\Users\twini\OneDrive\Desktop\React-Crypto-Exchange-master\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   'C:\\Users\\twini\\OneDrive\\Desktop\\React-Crypto-Exchange-master\\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 [email protected]
gyp info using [email protected] | 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 "C:\Users\twini\AppData\Local\Programs\Python\Python312\python.exe" in the PATH
gyp verb `which` succeeded C:\Users\twini\AppData\Local\Programs\Python\Python312\python.exe C:\Users\twini\AppData\Local\Programs\Python\Python312\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\twini\AppData\Local\Programs\Python\Python312\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: Missing parentheses in call to 'print'. Did you mean print(...)?  
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:422:12)
gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\twini\\OneDrive\\Desktop\\React-Crypto-Exchange-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\twini\OneDrive\Desktop\React-Crypto-Exchange-master\node_modules\node-sass
gyp ERR! node -v v20.9.0```


I've uninstalled and reinstalled python, and put it in my PATH. I've also deleted the node_modules and tried the install command again. And I've tried updating all of the dependencies in package.json, but no luck. Any suggestions would be appreciated.
javascript reactjs exit-code node-sass
1个回答
0
投票

更新路径变量后,您需要关闭并重新启动终端。您还可以将依赖项中的node-sass替换为sass。

© www.soinside.com 2019 - 2024. All rights reserved.