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.

brandoncraig
  • 53
  • 3
  • 10

2 Answers2

1

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

You can install node-sass@4.12 according to your node version.

hcc
  • 11
  • 2
  • 2
    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. ;) – secan Oct 16 '20 at 12:18
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? )