-1

i have this problem that looks like the others but i can't solve.

After git clone a repository with a ionic/capacitor project in it, i ran npm install several times to make sure everything was ok.

But it wasn't ok and i kept trying with other questions solution like running the next: ionic repair, ionic build, npm install <pkg> of every package i found in package.json manually, re-clone everything.

Why i can't serve my project anymore? How do i solve it? This is my project, that could be served just before i had to change pc but obviously i should already have all the software needed to serve it again.

Thanks everyone

Edit 1

With npm audit i find that almost all modules are missing. npm audit fix wont resolve the problem

Edit 2

With npm audit i can see this thing on few modules:

npm ERR!     Invalid: lock file's tslib@1.13.0 does not satisfy tslib@^2.0.0
J.J.Enrik
  • 180
  • 1
  • 9
  • What error are you getting ? – Akhil Jul 01 '20 at 20:35
  • right now i'm trying again and i get 'cannot find module typescript'...now i installed it manually with npm and after serving again it cannot find '@angular/compiler-cli' – J.J.Enrik Jul 01 '20 at 20:41
  • it just want me to install everything manually? why? it already knows missing modules so why can't it install them automatically? – J.J.Enrik Jul 01 '20 at 20:44
  • Try npm run ng serve.. if you don't have angular cli installed globally – Akhil Jul 01 '20 at 20:49
  • i get this error: `npm ERR! Invalid version: "4.0"`. but this had never been a problem before, and i don't know how to correct this. it may refer to the version i have in `pakage.json`, but every time i tried to correct it, it was always wrong.. – J.J.Enrik Jul 01 '20 at 20:52
  • instead of installing everything manually, can you run `npm install`? this will install everything in the package.json at the version it is specified at (if you haven't already installed it). – rhavelka Jul 01 '20 at 21:55

1 Answers1

0
  1. Build a new empty project
  2. Override that project with your custom assets and code inside the src folder.
  3. Install the dependecies in the new project without using the package.json from the corrupt project.
Jo Carrasco
  • 314
  • 3
  • 9
  • i'll do it now, thanks. any advice to avoid this in the future? – J.J.Enrik Jul 01 '20 at 21:16
  • because in big projects and when mine will have many parts and ios-targeted changes this solution may become a real problem – J.J.Enrik Jul 01 '20 at 21:26
  • I really sorry for that. I hope to find a solution later to tackle that particular case. – Jo Carrasco Jul 02 '20 at 00:05
  • This is a dependency related issue. Anything that is assets or source code can be saved. Hope this helps!. – Jo Carrasco Jul 02 '20 at 00:07
  • Try to have a very good internet connection when you do "npm install". Do not install dependencies with other version besides of what is already in the package.json, that affects a lot of the operations within the build/development of the app. And also, do not modify inner modules packages to make a "quick fix". When upgrading the ionic version. just copy assets and source code. Those things should protect you from future issues like this :). Happy Coding!! – Jo Carrasco Jul 02 '20 at 00:13