[英]Problem with node-sass on create-react-app
Before I post this question, I have tried all of the solution offered down below: ERROR in Cannot find module 'node-sass'在我发布这个问题之前,我已经尝试了下面提供的所有解决方案: 找不到模块'node-sass'中的错误
I use create-react-app to create project1 on Windows 10.我使用 create-react-app 在 Windows 10 上创建 project1。
My node version: node -v -> v12.16.3我的节点版本:node -v -> v12.16.3
Install node-sass: npm install node-sass@latest安装node-sass:npm install node-sass@latest
App.js:应用程序.js:
import React from 'react';
import "assets/scss/style.scss";
function App() {
return (
<div>Hi World</div>
);
}
export default App;
npm start
npm启动
Error on the browser: ./src/App.js Module not found: Can't resolve 'assets/scss/style.scss' in 'F:\project1\src'浏览器上的错误:./src/App.js 未找到模块:无法解析 'F:\project1\src' 中的 'assets/scss/style.scss'
I'm just wondering why isn't there a simpler and guarentee-to-work way to get this node-sass installed and run.我只是想知道为什么没有一种更简单和保证工作的方式来安装和运行这个 node-sass。 After I searched up for solution on google, it turns out that a lot of people (not only me) are having the same problem.
在我在谷歌上搜索解决方案后,发现很多人(不仅是我)都遇到了同样的问题。
https://github.com/sass/node-sass https://github.com/sass/node-sass
You can install node-sass@4.12 according to your node version.你可以根据你的node版本安装node-sass@4.12。
You just need to flow three steps:您只需要流程三个步骤:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.