ionic-team / ionic-cli

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

'ionic-app-scripts' is not recognized as an internal or external command #3729

Closed dewebeloper closed 5 years ago

dewebeloper commented 5 years ago

Description: I have Ionic demoapp made in VS Code which was worked just fine until one moment. Now when I run Ionic Serve command from VS code I get next:

PS E:\MobileApp\DemoApp1> ionic serve
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[app-scripts] 'ionic-app-scripts' is not recognized as an internal or external command,
[app-scripts] operable program or batch file.

[INFO] Looks like @ionic/app-scripts isn't installed in this project.

       This package is required for this command to work properly. The package provides a CLI utility, but the
       ionic-app-scripts binary was not found in your PATH.

? Install @ionic/app-scripts? Yes
> npm i -D -E @ionic/app-scripts
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated cryptiles@2.0.5: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated hoek@2.16.3: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated boom@2.10.1: This version is no longer maintained. Please upgrade to the latest version.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @ionic/app-scripts@3.2.0
updated 1 package and audited 6999 packages in 29.484s
found 5 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[app-scripts] 'ionic-app-scripts' is not recognized as an internal or external command,
[app-scripts] operable program or batch file.
[ERROR] ionic-app-scripts command not found.
PS E:\MobileApp\DemoApp1>

If I run ionic serve --verbose from VS code then I'm able to run and start my app.

However, if I run same ionic serve from cmd I'm also able to run server and start my app.

E:\MobileApp\DemoApp1>ionic serve
> ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[app-scripts] [07:35:59]  ionic-app-scripts 3.2.0
[app-scripts] [07:35:59]  watch started ...
[app-scripts] [07:35:59]  build dev started ...
[app-scripts] [07:35:59]  clean started ...
[app-scripts] [07:35:59]  clean finished in 36 ms
[app-scripts] [07:35:59]  copy started ...
[app-scripts] [07:35:59]  deeplinks started ...
[app-scripts] [07:35:59]  deeplinks finished in 35 ms
[app-scripts] [07:35:59]  transpile started ...
[app-scripts] [07:36:08]  transpile finished in 8.38 s
[app-scripts] [07:36:08]  preprocess started ...
[app-scripts] [07:36:08]  preprocess finished in 2 ms
[app-scripts] [07:36:08]  webpack started ...
[app-scripts] [07:36:08]  copy finished in 8.90 s
[app-scripts] [07:36:14]  webpack finished in 6.13 s
[app-scripts] [07:36:14]  sass started ...
[app-scripts] [07:36:16]  sass finished in 2.08 s
[app-scripts] [07:36:16]  postprocess started ...
[app-scripts] [07:36:16]  postprocess finished in 20 ms
[app-scripts] [07:36:16]  lint started ...
[app-scripts] [07:36:16]  build dev finished in 16.92 s
[app-scripts] [07:36:17]  watch ready in 17.73 s

[INFO] Development server running!

       Local: http://localhost:8100
       External: http://192.168.0.5:8100, http://192.168.56.1:8100, http://172.26.165.145:8100
       DevApp: DemoApp1@8100 on SERVER

       Use Ctrl+C to quit this process

[INFO] Browser window opened to http://localhost:8100!

[app-scripts] [07:36:30]  tslint: E:/MobileApp/DemoApp1/src/app/app.component.ts, line: 6
[app-scripts]             All imports on this line are unused.
[app-scripts]        L5:  import { SplashScreen } from '@ionic-native/splash-screen';
[app-scripts]        L6:  import {FavoritesPage} from '../pages/favorites/favorites'
[app-scripts] [07:36:30]  lint finished in 13.87 s
[app-scripts] Terminate batch job (Y/N)?
Terminate batch job (Y/N)? y

E:\MobileApp\DemoApp1>

My ionic info:

PS E:\MobileApp\DemoApp1> ionic info

Ionic:

   ionic (Ionic CLI)  : 4.3.1 (C:\Users\DjoleX\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

System:

   NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

PS E:\MobileApp\DemoApp1>

Any thoughts about this crazy behavior?

mattia1107 commented 5 years ago

Hi, had the same behaviour yesterday, while building in azure with a pipeline.

For now, I resolved this problem by using the version 4.2.1 forced and not the latest version, 4.3.1. I know that is not a solution, but for now I didn't find any other possibility.

Bests, Matt

micha-walter commented 5 years ago

Hi,

i think, the platform "windows" detecting is wrong. I fixed this for me, see

imhoffd commented 5 years ago

~@micha-walter Would you be up for submitting a PR? I am pretty confident that's what's wrong.~

EDIT: I pushed a commit.

ivanosire commented 5 years ago

Same error after updating to Ionic 4.3.1

[INFO] Looks like @ionic/app-scripts isn't installed in this project.

This fix works for me, thanks @micha-walter