Issue when run ionic serve

When run with the command ionic serve I was getting the below error. However I tried to install node-sass with the command npm i node-sass but nothing seem to work.

Could anyone please advise what I’m missing here. Appreciate the help!

> ng run app:serve --host=0.0.0.0 --port=8100
[ng] WARNING: This is a simple server for use in testing or debugging Angular applications
[ng] locally. It hasn't been reviewed for security issues.
[ng] Binding this server to an open connection can result in compromising your application or
[ng] computer. Using a different host than the one passed to the "--host" flag might result in
[ng] websocket connection issues. You might need to use "--disableHostCheck" if that's the
[ng] case.

[INFO] Development server running!
       
       Local: http://localhost:8100
       External: http://10.77.222.52:8100
       
       Use Ctrl+C to quit this process

[INFO] Browser window opened to http://localhost:8100!

[ng] ℹ 「wdm」: wait until bundle finished: /
[ng] Date: 2019-02-21T20:22:02.525Z
[ng] Hash: 09d9ad68db9f0d5aae6a
[ng] Time: 12006ms
[ng] 
[ng] ERROR in ./src/global.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/global.scss)
[ng] Module build failed (from ./node_modules/sass-loader/lib/loader.js):
[ng] Error: Cannot find module 'node-sass'
[ng]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[ng]     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[ng]     at Module.require (internal/modules/cjs/loader.js:637:17)
[ng]     at require (internal/modules/cjs/helpers.js:22:18)
[ng]     at Object.sassLoader (/Users/pavanchilukuri/Ionic Apps/myApp/node_modules/sass-loader/lib/loader.js:46:72)
[ng] ERROR in ./src/theme/variables.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/theme/variables.scss)
[ng] Module build failed (from ./node_modules/sass-loader/lib/loader.js):
[ng] Error: Cannot find module 'node-sass'
[ng]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[ng]     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[ng]     at Module.require (internal/modules/cjs/loader.js:637:17)
[ng]     at require (internal/modules/cjs/helpers.js:22:18)
[ng]     at Object.sassLoader (/Users/pavanchilukuri/Ionic Apps/myApp/node_modules/sass-loader/lib/loader.js:46:72)
[ng] ERROR in ./src/app/home/home.page.scss
[ng] Module build failed (from ./node_modules/sass-loader/lib/loader.js):
[ng] Error: Cannot find module 'node-sass'
[ng]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[ng]     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[ng]     at Module.require (internal/modules/cjs/loader.js:637:17)
[ng]     at require (internal/modules/cjs/helpers.js:22:18)
[ng]     at Object.sassLoader (/Users/pavanchilukuri/Ionic Apps/myApp/node_modules/sass-loader/lib/loader.js:46:72)
[ng] chunk {common} common.js, common.js.map (common) 18.5 kB  [rendered]
[ng] chunk {home-home-module} home-home-module.js, home-home-module.js.map (home-home-module) 6.51 kB  [rendered]
[ng] chunk {list-list-module} list-list-module.js, list-list-module.js.map (list-list-module) 5.77 kB  [rendered]
[ng] chunk {main} main.js, main.js.map (main) 32.9 kB [initial] [rendered]
[ng] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 237 kB [initial] [rendered]
[ng] chunk {runtime} runtime.js, runtime.js.map (runtime) 8.83 kB [entry] [rendered]
[ng] chunk {styles} styles.js, styles.js.map (styles) 19.4 kB [initial] [rendered]
[ng] chunk {vendor} vendor.js, vendor.js.map (vendor) 4.35 MB [initial] [rendered]
[ng] ℹ 「wdm」: Failed to compile.

Resolved it with the help of this post on Stackoverflow

Use the below command to install node-sass

sudo npm install --save-dev  --unsafe-perm node-sass
1 Like

Thank you it works for me now ! i had the same issue thank you so much !!