2

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.

1

2 Answers 2

1

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

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

Sign up to request clarification or add additional context in comments.

1 Comment

According to the OP question, s/he already installed node-sass therefore this is unlikely to solve the problem. If you think the issue might be linked to the package version and you want to double-check, maybe a comment would be a better place to ask for further information. ;)
0

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? )

3 Comments

That's why i have style.scss (instead of style.css) as I mentioned above.
May I know your style.scss path? I think, you are not providing correct path for style.scss file.
F:\Project1\src\assets\scss\style.scss

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.