Murilo
Murilo

Reputation: 1152

npm install and ionic build don't install all node modules

I need to build an existing Ionic app, but I'm with problems with node_modules. I have the following package.json

{
  "name": "My App",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/device": "^4.7.0",
    "@ionic-native/in-app-browser": "^4.9.2",
    "@ionic-native/local-notifications": "^4.10.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "4.7.0",
    "@ionic/storage": "^2.1.3",
    "cordova-android": "~7.0.0",
    "cordova-plugin-badge": "^0.8.7",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-inappbrowser": "^3.0.0",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.1.19",
    "cordova-plugin-local-notification": "^0.9.0-beta.2",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "montserrat-ionic": "0.0.3",
    "node-sass": "^4.13.0",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.2.4",
    "typescript": "~2.6.2"
  },
  "description": "App",
  "cordova": {
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-local-notification": {}
    },
    "platforms": [
      "android"
    ]
  }
}

I ran npm install and then some packages are installed:

es5-ext
es6-iterator
es6-symbol
ext
ext-tick

Then I ran ionic build and I get:

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

       This package is required for this command to work properly.

? Install @ionic/app-scripts?

I prompty yes, then many packages are installed:

added 571 packages from 604 contributors and audited 6254 packages in 45.72s

But I got an error:

[13:07:56]  ionic-app-script task: "build"
[13:07:56]  Error: ENOENT: no such file or directory, open
            'C:\...\App\node_modules\@angular\core\package.json'
Error: ENOENT: no such file or directory, open 'C:..\App\node_modules\@angular\core\package.json'

I noticed that @angular directory was not created.


Global Setup:

Angular CLI: 8.3.20 Node: 10.16.3

Ionic CLI : 5.4.13 (C:...\AppData\Roaming\npm\node_modules\ionic)

Ionic Framework : not installed

@ionic/app-scripts : 3.2.4

Cordova CLI : 9.0.0 ([email protected])

Cordova Platforms : not available

Cordova Plugins : not available

Upvotes: 1

Views: 3396

Answers (1)

Murilo
Murilo

Reputation: 1152

The problem was in the package.json file

"description" was in the wrong place and "name" should not have space. After fixing the file, npm install worked properly.

{
  "name": "MyApp",
   "description: ""
  ......
}

Upvotes: 3

Related Questions