"dotnet new react" 不允许我使用 sass 个文件
"dotnet new react" wont let me use sass files
我尝试制作一个带有 React 前端的 asp.core。
所以我 运行 “dotnet new react -o”命令。
这创建了一个 运行 可行的项目。
问题是它不能 运行 sass 文件。
所以我尝试在包含节点模块文件夹的客户端文件夹上使用“npm install node-sass”安装节点-sass。
安装查找。但给了我一个“节点 Sass 版本 6.0.1 与 ^4.0.0 不兼容”
我一直在用谷歌搜索这个。到目前为止,每个人都在说你需要卸载新版本并安装它
但是安装失败。'
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code 1
npm ERR! path C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\Program Files\nodejs\node.exe',
npm ERR! gyp verb cli 'C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-gyp\bin\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.3.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:195:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:195:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python39\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:326:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.3.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\[USER]\AppData\Local\npm-cache\_logs21-10-18T21_41_14_265Z-debug.log
希望有人能指出我的错误。谢谢你的时间。
我认为对你来说最简单的事情就是使用 npm uninstall node-sass
删除节点-sass
然后安装 sass
,您可以使用 npm i sass --save
找到 here 的 npm
因为我遇到了类似的问题,所以我使用了 sass
库而不是 node-sass
库。它具有所有相同的东西并且与 React
一样工作
我尝试制作一个带有 React 前端的 asp.core。 所以我 运行 “dotnet new react -o”命令。 这创建了一个 运行 可行的项目。 问题是它不能 运行 sass 文件。
所以我尝试在包含节点模块文件夹的客户端文件夹上使用“npm install node-sass”安装节点-sass。
安装查找。但给了我一个“节点 Sass 版本 6.0.1 与 ^4.0.0 不兼容”
我一直在用谷歌搜索这个。到目前为止,每个人都在说你需要卸载新版本并安装它
但是安装失败。'
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code 1
npm ERR! path C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\Program Files\nodejs\node.exe',
npm ERR! gyp verb cli 'C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-gyp\bin\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.3.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:195:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:195:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python39\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:326:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\[USER]\Documents\NewProject\NewProject\ClientApp\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.3.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\[USER]\AppData\Local\npm-cache\_logs21-10-18T21_41_14_265Z-debug.log
希望有人能指出我的错误。谢谢你的时间。
我认为对你来说最简单的事情就是使用 npm uninstall node-sass
然后安装 sass
,您可以使用 npm i sass --save
因为我遇到了类似的问题,所以我使用了 sass
库而不是 node-sass
库。它具有所有相同的东西并且与 React