我创建了一个空白的 React 项目,使用命令:npx create-react-appon npm v7.0.7 和 Node v15.0.1
安装:
然后我尝试将空白的 .scss 文件导入 App 组件:
应用程序.js
import './App.scss'
function App() {
return (
<div className="App">
App
</div>
);
}
export default App;
Run Code Online (Sandbox Code Playgroud)
抛出错误:
Failed to compile.
./src/App.scss (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-6-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--5-oneOf-6-3!./node_modules/s
ass-loader/dist/cjs.js??ref--5-oneOf-6-4!./src/App.scss)
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
Run Code Online (Sandbox Code Playgroud)
包.json
{
"name": "react-17-node-sass-5",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"node-sass": "^5.0.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"web-vitals": "^0.2.4" …Run Code Online (Sandbox Code Playgroud) 使用node-sass在Arch Linux上获取此错误.我正在使用gulp-sass.
Node Sass does not yet support your current environment: Linux 64-bit with false
Run Code Online (Sandbox Code Playgroud)
版本
$ gulp -v
[19:43:15] CLI version 3.9.1
[19:43:15] Local version 3.9.1
$ npm -v
3.9.0
Run Code Online (Sandbox Code Playgroud)
节点
$ node -v
v6.2.0
Run Code Online (Sandbox Code Playgroud)
即使使用此命令npm rebuild node-sass也不会改变任何内容.
我正在努力设置libsass,因为它不像基于Ruby的转换器那样直截了当.有人可以解释如何:
我对包管理器的经验很少,对于任务运行者来说更是如此.
我想node-sass在我的node.js v0.12应用程序中使用该模块以从中受益libsass.
我执行npm i node-sass安装模块,到目前为止没有错误.
现在乱七八糟的开始:
如果我只是打开REPL一个终端试用node-sass然后一切正常但如果我把它包含在我的项目文件中运行node myfile.js然后我得到以下错误信息:
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
Run Code Online (Sandbox Code Playgroud)
该模块在npmjs.com上的描述表明#!/usr/bin/env node在Ubuntu下可能存在解析问题以及如何解决这个问题但在我的机器上并非如此.
我找不到任何有用的东西,所以我希望你能帮助我.
我在Ubuntu 14.10下使用节点v0.12.2.
PS:我已经尝试重新安装node-sass但没有成功.没有什么变化.
我的问题似乎与此问题类似,但它发生在我yarn install在 Rails 应用程序中运行时。
当我运行时yarn install,它成功运行了一段时间,然后
../src/libsass/src/ast.hpp:1614:25: warning: loop variable 'numerator' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
for (const auto numerator : numerators)
^
../src/libsass/src/ast.hpp:1614:14: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
for (const auto numerator : numerators)
^~~~~~~~~~~~~~~~~~~~~~
&
../src/libsass/src/ast.hpp:1616:25: warning: loop variable 'denominator' of type 'const std::__1::basic_string<char>' creates a copy from type 'const std::__1::basic_string<char>' [-Wrange-loop-analysis]
for (const auto denominator : denominators)
^
../src/libsass/src/ast.hpp:1616:14: …Run Code Online (Sandbox Code Playgroud) E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj>ionic serve -l
(node:4772) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
There is an error in your gulpfile:
Error: Node Sass does not yet support your current environment: Windows 64-bit with false
For more information on which environments are supported please see:
TODO URL
at Object.<anonymous> (E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj\node_modules\node-sass\lib\index.js:12:11)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at …Run Code Online (Sandbox Code Playgroud) 我正在构建一个 Reactjs 项目并使用 scss 而不是 css。在 App.scss 文件中,我设置了不透明度:87%;(注:单位为百分比)。
当我运行命令时,一切正常(不透明度值仍然等于 87%):yarn start
但是当我运行命令:yarn build 并检查文件 build/static/css/main.86352307.chunk.css 中的值不透明度时,不透明度值更改为 1%。
文件 App.scss:
.App {
text-align: center;
opacity: 87%;
}
Run Code Online (Sandbox Code Playgroud)
构建项目后:文件 build/static/css/main.86352307.chunk.css
.App{text-align:center;opacity:1%}
/*# sourceMappingURL=main.86352307.chunk.css.map */
Run Code Online (Sandbox Code Playgroud)
重现问题的步骤
#1. npx create-react-app my-app
#2. cd my-app
#3. yarn add node-sass
#4. rename file App.css to App.scss and then add opacity: 87% in class .App
#Testcase 1: run yarn start => the opacity value (87%) is apply for class .App
#Testcase 2: run yarn build => the …Run Code Online (Sandbox Code Playgroud) 我正在尝试做,npm install并出现错误:
Failed at the node-sass@4.5.0 postinstall script.
Run Code Online (Sandbox Code Playgroud)
我试图删除node_modules然后重新安装它,出现相同的错误.什么是解决方案?
节点v8.9.3
npm v5.4.2
离子3.19.0
我刚刚从NPM安装了Flickity,并在运行后得到一份NPM审核安全报告,npm audit指出我对软件包tar上的任意文件覆盖存在严重的漏洞问题,这是node-sass的依赖项,您可以在此处看到:
High......................... Arbitrary File Overwrite
Package...................... tar
Patched in................... >=4.4.2
Dependency of................ node-sass [dev]
Path......................... node-sass > node-gyp > tar
More info.................... https://npmjs.com/advisories/803
Run Code Online (Sandbox Code Playgroud)
运行npm audit fix并不能解决问题,因为该漏洞需要手动检查。更多信息链接上的建议说要升级到版本4.4.2或更高版本。当我运行时,npm show tar version我意识到我正在运行版本4.4.8,这让我感到困惑。我去package-lock.json了解了node-gyp,它是node-sass的依赖项,它使用的是tar版本^ 2.0.0。
这使我感到困惑,因为我已经看到许多不同的tar版本是对其他软件包的依赖,但这node-sass > node-gyp > tar version是唯一的波纹管v4.4.2。为什么这样工作,为什么我必须手动修复它,以及如何手动修复/升级这个tar包?
每当我在 vue.js 项目上运行 npm install 时,都会收到以下错误
5769 error code 1
5770 error path /*my path*/node_modules/node-sass
5771 error command failed
5772 error command sh -c node scripts/install.js
5773 error /*my path*/node_modules/request/index.js:30
5773 error if (options !== null && typeof op
5773 error
5773 error
5773 error SyntaxError: Unexpected end of input
5773 error at Object.compileFunction (node:vm:352:18)
5773 error at wrapSafe (node:internal/modules/cjs/loader:1031:15)
5773 error at Module._compile (node:internal/modules/cjs/loader:1065:27)
5773 error at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
5773 error at Module.load (node:internal/modules/cjs/loader:981:32)
5773 error at Function.Module._load (node:internal/modules/cjs/loader:822:12) …Run Code Online (Sandbox Code Playgroud)