brandoncraig
brandoncraig

Reputation: 197

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'

I use create-react-app to create project1 on Windows 10.

My node version : node -v -> v12.16.3

Install node-sass : npm install node-sass@latest

App.js :

import React from 'react';

import "assets/scss/style.scss";


function App() {
  return (
     <div>Hi World</div>
  );
}

export default App;

npm start

Error on the browser : ./src/App.js Module not found: Can't resolve 'assets/scss/style.scss' in 'F:\project1\src'

I'm just wondering why isn't there a simpler and guarentee-to-work way to get this node-sass installed and run. After I searched up for solution on google, it turns out that a lot of people (not only me) are having the same problem.

Upvotes: 2

Views: 4376

Answers (2)

hcc
hcc

Reputation: 11

https://github.com/sass/node-sass

You can install [email protected] according to your node version.

Upvotes: 1

Vaishali Shah
Vaishali Shah

Reputation: 13

You just need to flow three steps:

  1. npm install node-sass
  2. change file extension ( .css to .scss )
  3. change any import to .scss
  4. provide proper path for style.scss file( May I know your style.scss path? )

Upvotes: 0

Related Questions