Transferred Ionic 2 project from mac to windows


#1

I have just transferred ionic 2 project code from mac to windows and when i am trying to run ionic serve. I am getting this error, please check below:

ionic-hello-_emphasized text_world@ ionic:serve D:\Applications\App
ionic-app-scripts serve
    
'ionic-app-scripts' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 6.3.9600`Preformatted text`
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bi

npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ ionic:serve: `ionic-app-scripts serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@ ionic:serve script 'ionic-app-scripts serve'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Applications\App\npm-debug.log
There was an error serving your Ionic application: There was an error with the spawned command: serve

#2

Try to follow these steps.
in your project directory run these commands:

rm -rf node_modules

ionic build android

ionic run android


#3

Hi,

Thanks for the reply. rm -rf node_modules is not working,

'rm' is not recognized as an internal or external command,
operable program or batch file.

#4

which OS are you using?

If you are using windows then this may work:
del node_modules

or you can go to directly into your project directory and just delete the node_modules directory.

After that try to run these commands:
ionic build android
ionic run android


#5

I am using windows.
del node_modules worked
but getting same error on ionic build android


#6

after del node_modules

try npm install

and after that ionic build android


#7

npm install worked. Same error on ionic build android


#8

Try this may help http://stackoverflow.com/questions/27454810/ionic-is-not-recognized-as-an-internal-or-external-command

OR
compare your tsconfig.json file with the following and then use ionic build command

OR try this too


i.e.

$ ionic platform remove ios or ionic platform remove android
$ ionic hooks add
$ ionic platform ios or ionic platform android


#9

Did you managed to fix that?? I have the same issue. tried install ionic and cordova after unistall and it still not working


#10

No, Didn’t managed to fix this. Will work on the same later, currently working on mac for both (ios and android). Please let me know if you fix this.


#11

Wasn’t working on this topic since one month. Worked yesterday and solved.

Run below commands step wise in your project:

  1. npm install @ionic/app-scripts@latest
  2. npm rebuild node-sass
  3. ionic platform remove android
  4. ionic platform add android

Now try to run ionic run android. It should work (worked for me).


#12

npm rebuild node-sass
will work