[Solved] Unable to run ionic 1 project with ionic 3 CLI


#1

Hi,

I having several ionic v1 project running.
And would like to try out the ionic v3 now, upgrade to ionic 3 successfully and can start and serve / build ionic 3 project properly.

But i found that all my existing ionic v1 project cannot serve or build anymore.
Tried some method i read online but still cannot solve it.

  1. NPM install
  2. install or update @ionic/app-scripts

The only solution is I downgrade ionic 3 back to ionic 2 then only can run ionic 1 existing project properly.
This really stoping me to explore ionic v3 for my new project and appreciate if anyone got idea.
Thanks

Error as per below

Error: Cannot find module '/Users/.../node_modules/@ionic/app-scripts'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/.../node_modules/@ionic/cli-utils/lib/ionic-angular/app-scripts.js:9:16)
    at Generator.next (<anonymous>)
    at /Users/.../node_modules/tslib/tslib.js:107:75
    at Promise (<anonymous>)
    at Object.__awaiter (/Users/.../node_modules/tslib/tslib.js:103:16)
    at Object.importAppScripts (/Users/.../node_modules/@ionic/cli-utils/lib/ionic-angular/app-scripts.js:7:20)


#2

Ionic 3 uses a totally different language from ionic 1…a total different language with different way of designing…

If you are using ionic 1 you are pretty much stuck with ionic 1


#3

@jchoh0522, got it, thanks.
Do you have any idea how could I setup ionic 1 environment locally for certain project?
Because I am keen to learn ionic 3 and use it for further project.


#4

While this isn’t untrue, the topic is asking about using Ionic 3 CLI with an Ionic 1 project.

What does ionic info output?


#5

Well, most of the common command line available in Ionic 3 CLI would not make any sense in the context of Ionic 1 (AngularJS).

How does ionic generate component/page/provider make any sense in angularJS? AngularJS runs on service, factory and scope that doesn’t exist in Ionic 2 which is based on typescript?

While in the early days, ionic 2 CLI works with ionic 1 since you can specify the command ionic start myApp --v2 to indicate the project to be version 2 (and lack of --v2 assumes version 1), ionic 3 CLI no longer follow such a thing


#6

@jchoh0522, you are wrong here. Current Ionic CLI works just fine with all Ionic projects - also v1. Even the current RC of Ionic CLI 4.x contains a parameter for start to create a new Ionic v1 project.

So @dodomui, you should be just fine with the newest CLI. Start by posting your ionic info so we can take a look.


#7

@SigmundFroyd @Sujan12
Thanks for the helping.
Here is my ionic info while running ionic info under the ionic 1 project folder.

$ ionic info
[ERROR] Error with ./node_modules/@ionic/app-scripts/package.json file: FILE_NOT_FOUND

cli packages: (/Users/…/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : not installed
Cordova Platforms  : android 6.3.0 ios 4.1.1
Ionic Framework    : ionic-angular 1.3.5

System:

ios-deploy : 1.9.2 
ios-sim    : 5.0.13 
Node       : v9.10.1
npm        : 5.6.0 
OS         : macOS High Sierra
Xcode      : Xcode 9.3 Build version 9E145 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

It showing the app-script package was not installed.
Btw, I did try install by using sudo npm install @ionic/app-scripts@latest --save-dev
and received permission error.
app-scripts was installed properly on other ionic3 project.
I did try copy app-scripts folder from ionic3 project and try to run ionic build ios / android and receive error tsconfig.json’: ENOENT: no such file or directory


#8

What does your package.json look like?
Try deleting node_modules and then running npm install again.

What exact permission error are you getting?

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


#9

I did tried uninstall node_modules folder and run npm install also.
It still prompt
Error: Cannot find module ‘/Users/…/node_modules/@ionic/app-scripts’

The permission error while trying to install app-script package

sudo npm install @ionic/app-scripts@latest --save-dev

Error: EACCES: permission denied, mkdir ‘/Users/…/node_modules/@ionic/app-scripts/node_modules/node-sass/build’

The cordova ios i limit at 4.1.1 is because some of the plugin seem compatible with 4.1.1 only.
I did try upgrade before then cannot proceed so downgrade back to 4.1.1.

Anyway, I will try to update cordova android and ios version also.


#10

That’s strange and shouldn’t happen.

Your problem is probably with npm, something to do with permissions and files. This happens quite often and is almost impossible to successfully debug (at least here in the forum).

One solution: 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. The problem should be gone.


#11

Thanks. the problem solved.
Re-install still cannot solve the problem.
I try start new ionic v1 project using cli command. Then copy all my coding from previous project to the new created project then everything working fine.