Failed to compile on Ionic while serving

#1

Description:

Hi. This is my first time using Ionic. I am a beginner in general about coding so my skills are not really huge. I want to make an app cross-platformed, and when I try to make a new project (blank or tabs), I have a problem when I serve, it fails to compile. On Chrome I have a blank page with “Cannot GET /”…
I need your help to solve this.
Thanks :slight_smile:

Steps to Reproduce:
(on MacOS Mojave version 10.14.4)
Install Node.js
sudo npm install -g npm@lts
sudo npm install -g ionic cordova
sudo ionic start mon-projet-ionic blank
cd mon-projet-ionic
ionic serve

It opens a new tab on Chrome : “cannot GET /”

Output:

[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:582:15)
[ng] at Function.Module._load (internal/modules/cjs/loader.js:508: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/…/mon-projet-ionic/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:582:15)
[ng] at Function.Module._load (internal/modules/cjs/loader.js:508: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/…/mon-projet-ionic/node_modules/sass-loader/lib/loader.js:46:72)

[ng] chunk {common} common.js, common.js.map (common) 18.5 kB [rendered]
[ng] chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 284 kB [initial] [rendered]
[ng] chunk {home-home-module} home-home-module.js, home-home-module.js.map (home-home-module) 4.83 kB [rendered]
[ng] chunk {main} main.js, main.js.map (main) 31.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.79 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.37 MB [initial] [rendered]
[ng] :information_source: 「wdm」: Failed to compile.

and while trying to install “node-sass” ( sudo npm i node-sass) I got this :
gyp ERR! configure error

gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/Users/…/node_modules/node-sass/build’

gyp ERR! System Darwin 18.5.0

gyp ERR! command “/usr/local/bin/node” “/Users/…/node_modules/node-gyp/bin/node-gyp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=”

gyp ERR! cwd /Users/…/node_modules/node-sass

gyp ERR! node -v v10.15.3

gyp ERR! node-gyp -v v3.8.0

gyp ERR! not ok
npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! node-sass@4.11.0 postinstall: node scripts/build.js

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the node-sass@4.11.0 postinstall script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

#2

Can you post the version of node and ionic that you are using?

#3

Oh sorry I thought I pasted it, here you go :

My ionic info :

Ionic CLI version 4.12.0
NPM version 6.8.0
Node.js version 10.15.3 LTS