I have this strange error when trying to git push my latest version to ionic pro platform.
In this log you see the ionic build --prod fails but on my local machine this is just building well !
The error says "Cannot find module ‘./_rules’ which is something I never heared of before.
Googling for it didn’t take me any further…
Any ideas please ?
npm install succeeded
remote: Detected local install of ionic cli…
remote: Running: ionic build --prod
remote: [ANNOUNCE] Hi! Welcome to CLI 3.9.
remote:
remote: We decided to merge core plugins back into the main ionic CLI package. The @ionic/cli-plugin-ionic-angular, @ionic/cli-plugin-ionic1, @ionic/cli-plugin-cordova, and @ionic/cli-plugin-gulp plugins have all been deprecated and won’t be loaded by the CLI anymore. We listened to devs and determined they added unnecessary complexity. You can uninstall them from your project(s).
remote:
remote: No functionality was removed and all commands will continue working normally. You may wish to review the CHANGELOG: https://github.com/ionic-team/ionic-cli/blob/master/CHANGELOG.md#changelog
remote:
remote: Thanks,
remote: The Ionic Team
remote:
remote:
remote: Error: Cannot find module ‘./_rules’
remote: ionic build failed…falling back to npm run build
remote: Running: npm run build
remote: npm info it worked if it ends with ok
remote: npm info using npm@5.3.0
remote: npm info using node@v8.2.1
remote: npm info lifecycle prono@0.0.1~prebuild: prono@0.0.1
remote: npm info lifecycle prono@0.0.1~build: prono@0.0.1
remote:
remote: > prono@0.0.1 build /usr/src/app
remote: > ionic-app-scripts build
remote:
remote: module.js:487
remote: throw err;
remote: ^
remote:
remote: Error: Cannot find module ‘./_rules’
remote: at Function.Module._resolveFilename (module.js:485:15)
remote: at Function.Module._load (module.js:437:25)
remote: at Module.require (module.js:513:17)
remote: at require (internal/module.js:11:18)
remote: at Object. (/usr/src/app/node_modules/ajv/lib/compile/rules.js:3:19)
remote: at Module._compile (module.js:569:30)
remote: at Object.Module._extensions…js (module.js:580:10)
remote: at Module.load (module.js:503:32)
remote: at tryModuleLoad (module.js:466:12)
remote: at Function.Module._load (module.js:458:3)
remote: npm info lifecycle prono@0.0.1~build: Failed to exec build script
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! prono@0.0.1 build: ionic-app-scripts build
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the prono@0.0.1 build script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /home/gitlab-runner/.npm/_logs/2017-08-26T15_39_42_199Z-debug.log
remote: npm run build failed
Please take a look at included log file.
I first updated cordova CLI + platforms, they have higher version numbers now according to ionic
Then I uninstalled the cli-plugin with “npm uninstall @ionic/…”
Running the build --prod still works fine, the remote build still fails…
Honestly I am a bit angry about this because I wanted to upgrade to pro (and paid plan) because of the notification that the old platform will disappear by Jan 31st 2018.
My app is perfectly working (and in production) in the old platform without any issue, but whenever I want to migrate it to ionic Pro I get this error.
This means I have to migrate my app while installed at my customers, which I don’t like at all…
I think the same app with the same codebase should work on both the old and new platform, disregarding the payment plan you are on
Don’t tell us, tell that to Ionic. We can’t do a thing about it.
(If you want to upgrade to a paid plan anyway, maybe just do it now to get proper support?)
Can you create a new project with ionic start blank blank and see if you can build this? Then we know it is something wrong with your specific project.
I already contacted support and I have also aKickstarter plan so let’s wait and see what the have to say. The builts started to fail once I migrated from ionic push from cloud services to ionic onesignal since, as you have said the old platform will dissapear soon. So it might be something related to that, when did started to fail in your case? from the beginning?
You should both post your ionic cordova plugin list and compare it. @racafe You should also run ionic info and post the output so it can be compared to @robrechtvm 's above.
@robrechtvm@Sujan12 I manage to solve the issue. The problem was with the package-lock.json, for some reason after updating node or working with different versions of npm the package-lock.json file ended up corrupted or something and needed to make a fresh install of npm but in order to do that i had to erase node_modules/ folder and also the package-lock.json file. Since I dont have direct access to the uploaded files and folders i added in package.json at the scripts the preinstall action to erase that file and folders, so my package.json looks something like this:
So the node_modules on the Ionic Pro server got corrupted and you added this line to fix this remotely - correct? Whoah!
That is a workaround, but normally this file should really be there as it defines exactly which versions are installed while package.json only specifies ranges of versions.