ionic-team / ionic-cli

The Ionic command-line interface
MIT License
2k stars 652 forks source link

@ionic/App-script and other modules missing #2791

Open Alifarmand opened 7 years ago

Alifarmand commented 7 years ago

I have a project that I started last year, but this year I can't seem to get it up and running. It says that the ionic/app-script is missing, and if I manually install that, it says Cannot find module angular/tsc-wrapped/src/tsc, which I can't install.

However, I started the project last year around september, but currently I have the following installed:

This is the package.json from the project:

{
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/http": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "es6-shim": "0.35.1",
    "ionic-angular": "2.0.0-beta.11",
    "ionic-native": "1.3.10",
    "ionicons": "3.0.0",
    "reflect-metadata": "0.1.8",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "0.6.12"
  },
  "devDependencies": {
    "del": "2.2.0",
    "gulp": "3.9.1",
    "gulp-watch": "4.3.5",
    "ionic-gulp-browserify-typescript": "2.0.0",
    "ionic-gulp-fonts-copy": "^1.0.0",
    "ionic-gulp-html-copy": "^1.0.0",
    "ionic-gulp-sass-build": "^1.0.0",
    "ionic-gulp-scripts-copy": "^2.0.0",
    "ionic-gulp-tslint": "^1.0.0",
    "tslint-ionic-rules": "0.0.4",
    "run-sequence": "1.1.5"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "name": "drinkmate",
  "description": "drinkmate: An Ionic project"
}

I have NVM and I have tried to run it with earlier versions of Node but without any luck. What is the issue here and how can I overcome it so I can run my project?

jun58 commented 7 years ago

I have too (run ionic serve error cannot find '\node_modules\@ionic\app-scripts')

jun58 commented 7 years ago

I dont know what's wrong image

jun58 commented 7 years ago

I find it, checkout branch master(I am in branch typescript before)

Alifarmand commented 7 years ago

it doesn't matter which branch I try from. All of the were working before.

Alifarmand commented 7 years ago

I uninstalled current ionic version and installed an earlier version which had release date around the same time I had the first push to bitbucket. I installed the angular-cli and now it's working.

jun58 commented 7 years ago

@Alifarmand you mean you had wrong ionic version?you have install ionic before the project?

Alifarmand commented 7 years ago

@jun58 The project was built last year where Ionic version 2 was newly released. When I wanted to run the project now, I just ran

npm install -g ionic cordova

Therefor it installed the Ionic v3.12.0, which was not working with my project.

sudo npm uninstall -g ionic
npm install -g ionic@2

That solved the issue and I also had to install angular-cli globally to have all the modules.

jun58 commented 7 years ago

@Alifarmand ok,I understand

imhoffd commented 7 years ago

@Alifarmand @jun58 Please do not use the legacy CLI.

The error is that @ionic/app-scripts is missing. You must install it into your project:

npm install --save @ionic/app-scripts
Alifarmand commented 7 years ago

@dwieeb as I mentioned above @ionic/app-script is missing, and if I manually install that and save it in dependencies, I get another error that says @angular/tsc-wrapped/src/tsc.

imhoffd commented 7 years ago

@Alifarmand That's a fairly common error with Angular apps, I've seen it a few times.

Here are some resources for things to try: https://github.com/ionic-team/ionic-app-scripts/issues/1252 https://github.com/ionic-team/ionic/issues/12357

Somewhere along the way, this dependency gets lost, but it isn't because of the Ionic CLI version you're using.

neoassyrian commented 7 years ago

Im getting that similar (if not the same) error when building in the ionic cloud pro.

romain10009 commented 7 years ago

if you get an error with just npm install it, that fixed it for me npm install --save-dev @angular/tsc-wrapped

Alifarmand commented 7 years ago

Conclusion: This scenario is when you want to run an application that was built with a different version of ionic. So this issues was solved!

With node you have NVM for multiple versions. Is there a way to have multiple ionic versions installed to switch between depending on the project? @dwieeb

imhoffd commented 7 years ago

@Alifarmand What do you mean by "ionic"? The framework, or the CLI?

Alifarmand commented 7 years ago

@dwieeb I mean the version you get when you run npm install -g ionic

imhoffd commented 7 years ago

@Alifarmand What is the use case for having multiple CLI versions? The latest CLI supports all Ionic framework versions.