Ionic Error Cannot find Module

#1

Please can some one help me out with this? i have tried to install ionic again and even uninstalled node js and reinstalled it. But i keep getting this Ionic Error

C:\n\Fs>ionic serve
internal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module ‘make-dir’
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (C:\Users\DONSPLASH\AppData\Roaming\npm\node_modules\i
onic\node_modules@ionic\cli-framework\utils\fs.js:6:17)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)

#2

i deleted the AppData Roaming Folder Manually and Reinsatlled Ionic and its working now But All my Old Projects are complaining of app-scripts see Below


C:\n\Fs>ionic serve
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729
--dev-logger-port 53703 --nobrowser
[app-scripts] C:\n\Fs\node_modules\node-sass\lib\binding.js:13
[app-scripts]       throw new Error(errors.unsupportedEnvironment());
[app-scripts]       ^
[app-scripts] Error: Node Sass does not yet support your current environment: Wi
ndows 64-bit with Unsupported runtime (64)
[app-scripts] For more information on which environments are supported please se
e:
[app-scripts] https://github.com/sass/node-sass/releases/tag/v4.7.2
[app-scripts]     at module.exports (C:\n\Fs\node_modules\node-sass\lib\binding.
js:13:13)
[app-scripts]     at Object.<anonymous> (C:\n\Fs\node_modules\node-sass\lib\inde
x.js:14:35)
[app-scripts]     at Module._compile (internal/modules/cjs/loader.js:689:30)
[app-scripts]     at Object.Module._extensions..js (internal/modules/cjs/loader.
js:700:10)
[app-scripts]     at Module.load (internal/modules/cjs/loader.js:599:32)
[app-scripts]     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[app-scripts]     at Function.Module._load (internal/modules/cjs/loader.js:530:3
)
[app-scripts]     at Module.require (internal/modules/cjs/loader.js:637:17)
[app-scripts]     at require (internal/modules/cjs/helpers.js:20:18)
[app-scripts]     at Object.<anonymous> (C:\n\Fs\node_modules\@ionic\app-scripts
\dist\core\bundle-components.js:6:16)

[INFO] Looks like @ionic/app-scripts isn't installed in this project.

       This package is required for this command to work properly.

? Install @ionic/app-scripts? (Y/n)

And When i finally press Yes i get the Following So ia m not Able to Serve or Build Old Projects except new onces i just created


? Install @ionic/app-scripts? Yes
> npm i -D -E @ionic/app-scripts
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Br
owserslist >3.0 config used in other tools.
npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)

+ @ionic/app-scripts@3.1.9
added 15 packages from 21 contributors, removed 170 packages, updated 74 package
s, moved 8 packages and audited 3582 packages in 178.878s
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729
--dev-logger-port 53703 --nobrowser
[app-scripts] C:\n\Fs\node_modules\node-sass\lib\binding.js:13
[app-scripts]       throw new Error(errors.unsupportedEnvironment());
[app-scripts]       ^
[app-scripts] Error: Node Sass does not yet support your current environment: Wi
ndows 64-bit with Unsupported runtime (64)
[app-scripts] For more information on which environments are supported please se
e:
[app-scripts] https://github.com/sass/node-sass/releases/tag/v4.7.2
[app-scripts]     at module.exports (C:\n\Fs\node_modules\node-sass\lib\binding.
js:13:13)
[app-scripts]     at Object.<anonymous> (C:\n\Fs\node_modules\node-sass\lib\inde
x.js:14:35)
[app-scripts]     at Module._compile (internal/modules/cjs/loader.js:689:30)
[app-scripts]     at Object.Module._extensions..js (internal/modules/cjs/loader.
js:700:10)
[app-scripts]     at Module.load (internal/modules/cjs/loader.js:599:32)
[app-scripts]     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[app-scripts]     at Function.Module._load (internal/modules/cjs/loader.js:530:3
)
[app-scripts]     at Module.require (internal/modules/cjs/loader.js:637:17)
[app-scripts]     at require (internal/modules/cjs/helpers.js:20:18)
[app-scripts]     at Object.<anonymous> (C:\n\Fs\node_modules\@ionic\app-scripts
\dist\core\bundle-components.js:6:16)
[ERROR] ionic-app-scripts command not found.
#3

That’s your actual error.

What is your ionic info output?

#4

Sujan all my Old apps Are not Ruining anymore. here is the Ionic info in the project that gave the error above

C:\n\Fs>ionic info
√ Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)  : 4.0.6 (C:\Users\DONSPLASH\AppData\Roaming\npm\node_modul
es\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.9

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : not available

System:

   Android SDK Tools : 24.4.1
   NodeJS            : v10.8.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.2.0
   OS                : Windows 7

Environment:

   ANDROID_HOME : D:\dev\sdk\
#5

That is all outdated:

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: https://ionic.zone/cordova/update

That is too new for node-sass, as the error message says. You should install the LTS version (currently 8.11.3).

#6

hello Suraj even with this am still getting Errors Not able to run Ionic serve Etc at least this have the latest App Script installed.

But if i create a New Project Everything Works Perfectly well Up to build with cordova and android

My problem now is that All my Old Projects are not Working Even the once with update App Script.

C:\n\Joyfulword>ionic info
√ Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)  : 4.0.6 (C:\Users\DONSPLASH\AppData\Roaming\npm\node_modul
es\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : none

System:

   Android SDK Tools : 24.

4.1
NodeJS : v10.8.0 (C:\Program Files\nodejs\node.exe)
npm : 6.2.0
OS : Windows 7

Environment:

ANDROID_HOME : D:\dev\sdk\

C:\n\Joyfulword>ionic serve
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729
--dev-logger-port 53703 --nobrowser
[app-scripts] 'ionic-app-scripts' is not recognized as an internal or external c
ommand,
[app-scripts] operable program or batch file.

[INFO] Looks like @ionic/app-scripts isn't installed in this project.

       This package is required for this command to work properly.

? Install @ionic/app-scripts? (Y/n)
#7

Read what I wrote. Your node is too new for a dependency of app-scripts. If you change your environment, of course stuff can break.

#8

Sujan Yeah i saw that. i upgraded because i couldn’t successfully re install ionic after i uninstalled it.
i will revert Node now to v8.11.3 LTS let me see i will let you know what happens thanks for your response i really Appreciate Nice Work with ionic.zone.

#9

Sujan I have Down graded my Node to v8.11.3 LTS but still the Error Persist what do you Suggest i do? should i un install Ionic and downgrade or just re install again or what do you suggest.

Because if i create ne Apps they Work Fine But all my Old Apps even the once with Updated App Script are not working i cant run ionic serve on them

#10

When you downgraded node, ionic (Ionic CLI) will not be installed any more. You have to install it again.

When you did, remove node_modules and run npm install again for the project.

#11

Sujan i dont get your Question about node_modules for each project folder?
And as for ionic CLI it is still much installed even after i uninstalled node v10 and installed node v8.11.3 LTS ionic cli is still very much working

#12

Then something fishy is going on with your system. ionic is installed into npm and your node installation.

My suggestion:
Uninstall your node, install nvm (or nvm-windows if you are on Windows), install a new node (which includes npm) with this, then install ionic and cordova again and try your command again.

#13

Sujan Thak you But for some Wiedo Reason this is what all my projects is now showing please any help??

C:\n\Joyfulword>ionic s
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729
--dev-logger-port 53703 --nobrowser
[app-scripts] 'ionic-app-scripts' is not recognized as an internal or external c
ommand,
[app-scripts] operable program or batch file.

[ERROR] @ionic/app-scripts is required for ionic serve to work properly.

        Looks like @ionic/app-scripts isn't installed in this project.

        This package is required for ionic serve in ionic/angular 4 projects.
#14

Did you delete node_modules and run npm install so the broken install of app-scripts gets removed and reinstalled?

1 Like
#15

Thanks Sujan that is What i just did now and its working so i will have to do that for all my old projects Thanks

1 Like
#16

@Sujan12 Please i need a quick help on this
i am having NGC build error When i build with —prod
here is what is causing the problem. i am pulling data from a REST endpoint and i have to access the arrray from the data .

NOTE Everything Works well on ionic Serve although it still show the error warning. But i cant build it because of this getcontent Error What do you Suggest
Typescript Error

Property ‘getcontent’ does not exist on type ‘{}’.

C:/n/Joyfulword/src/pages/reflections/reflections.ts

.then(data => {
this.word = data.getcontent;
console.log(this.word);
getword(cat){
	this.dat.allcon(cat)
    .then(data => {
      this.word = data.getcontent;
      console.log(this.word);
    });
}

SERVICE

allcon(cat){
  	let params = new HttpParams().set('cat', cat);
  	return new Promise(resolve => {
    this.http.get(this.apiUrl+'/getcontent',{
    	params: params
    }).subscribe(data => {
      resolve(data);
    }, err => {
      console.log(err);
    });
  });
  }
#17

Open a new topic for your problem please, this has nothing to do with the initial problem you had.

#18

@Sujan12 Thanks Already sorted it Out .