Search code examples
angularionic-frameworkcapacitor

Unable to use ionic on new pc - cannot serve a blank project


The disk on my computer was recently corrupted. I had to get it replaced. After replacing I have been having some serious problems reinstalling ionic.

after reinstalling node.js - 13.7.0

then in cmd after running

 npm install -g ionic

I get the following warning but seems to install ok.

 npm WARN deprecated [email protected]: Please note that v5.0.1+ of superagent removes User-Agent 
  header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a 
 User- 
  Agent header).  This notice will go away with v5.0.2+ once it is released.
  C:\Users\stephen\ionic -> C:\Users\stephen\node_modules\ionic\bin\ionic
  + [email protected]
  added 247 packages from 154 contributors in 18.455s

I checked the version

 ionic version

returned 5.4.15 so installed fine

But after running

 ionic start 

and run a blank project I get the following error.

 npm WARN [email protected] requires a peer of jasmine-core@>=3.5 but none is 
 installed. You must install peer dependencies yourself.
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack- 
 dev-server\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: 
 Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: 
 {"os":"win32","arch":"x64"})
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] 
 (node_modules\watchpack\node_modules\fsevents):
 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 
 wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] 
 (node_modules\karma\node_modules\fsevents):
 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 
 wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] 
 (node_modules\@angular\compiler-cli\node_modules\fsevents):
 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 
 wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: 
 wanted 
 {  "os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

 npm ERR! code EEXIST
 npm ERR! path C:\Users\stephen\test3\node_modules\browserslist\cli.js
 npm ERR! dest C:\Users\stephen\test3\browserslist
 npm ERR! EEXIST: file already exists, cmd shim 
'C:\Users\stephen\test3\node_modules\browserslist\cli.js' 
 -> 
'C:\Users\stephen\test3\browserslist'
npm ERR! File exists: C:\Users\stephen\test3\browserslist
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.


npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\stephen\AppData\Roaming\npm-cache\_logs\2020-01-31T11_10_22_715Z- 
debug.log
[ERROR] An error occurred while running subprocess npm.

It does create the blank project, but I attempt to serve it I get the following error:

 ionic : The term 'ionic' is not recognized as the name of a cmdlet, function, script file, or 
 operable program. 
 Check the spelling of the name, or if a 
 path was included, verify that the path is correct and try again.
 At line:1 char:1
 + ionic serve
 + ~~~~~
 + CategoryInfo          : ObjectNotFound: (ionic:String) [], CommandNotFoundException
 + FullyQualifiedErrorId : CommandNotFoundException

I see they have updated to ionic 5 which I am guessing is the issue. How can I install ionic 4???


Solution

  • The problem arose because I had ionic files saved on my desktop, pre ionic install.

    I uninstalled ionic, and node.js. moved all files to a external hard drive and shutdown my pc.

    Rebooted my computer, re-installed node.js and ionic.