ionic-cli
ionic-cli copied to clipboard
Local repository in package.json yields malformed error
Description:
When I run ionic build I get [ERROR] The project's package.json file seems malformed. but when I run ng build it succeeds.
The cause seems to be the addition of local repositories in my package.json
I fixed bugs in third party libraries, and am referencing my local forks like so:
{
"dependencies": {
...
"the-package-name": "file:../the-package-name",
...
}
}
The JSON is well-formed and parseable. npm install succeeds (and creates the symbolic link as npm link would), and ng build succeeds.
Steps to Reproduce:
Add your own local file dependency to package.json, then try to run ionic build.
Output:
ionic:lib Terminal info: { ci: false, shell: 'C:\WINDOWS\system32\cmd.exe', tty: true, windows: true } +0ms ionic:lib CLI global options: { _: [ 'build' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +4ms ionic:lib:project Project type from config: @ionic/angular (angular) +0ms ionic:lib:project Project details: { context: 'app', type: 'angular', errors: [], configPath: 'C:\code\dirtbag\ionic.config.json' } +0ms ionic Context: { binPath: 'C:\Users\byron\AppData\Roaming\npm\node_modules\@ionic\cli\bin\ionic', libPath: 'C:\Users\byron\AppData\Roaming\npm\node_modules\@ionic\cli', execPath: 'C:\code\dirtbag', version: '6.12.4' } +0ms ionic:lib:build build options: { ionic:lib:build '--': [], ionic:lib:build engine: 'browser', ionic:lib:build platform: undefined, ionic:lib:build project: 'app', ionic:lib:build verbose: true, ionic:lib:build configuration: undefined, ionic:lib:build sourcemaps: undefined, ionic:lib:build cordovaAssets: true, ionic:lib:build watch: undefined, ionic:lib:build type: 'angular' ionic:lib:build } +0ms ionic:lib:telemetry Sending telemetry for command: 'ionic build' [ '--verbose', '--interactive', '--color' ] +0ms ionic:lib:build Looking for ionic:build npm script. +12ms [ERROR] The project's package.json file seems malformed. ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms ionic:utils-process onBeforeExit handler: running 0 functions +1ms ionic:utils-process processExit: exiting (exit code: 1) +0ms
My ionic info:
Ionic:
Ionic CLI : 6.12.4 (C:\Users\byron\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 5.5.3
@angular-devkit/build-angular : 0.1101.4
@angular-devkit/schematics : 10.0.8
@angular/cli : 11.1.4
@ionic/angular-toolkit : 2.3.3
Capacitor:
Capacitor CLI : 2.4.6
@capacitor/core : 2.4.6
Utility:
cordova-res : 0.15.3
native-run : not installed
System:
NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe)
npm : 8.1.0
OS : Windows 10
Other Information:
i have the same problem, did you resolve it ?
No. The workaround is to not use ionic.