0

I'm an absolute novice in Ionic, Cordova and Node.js.

I have the following problem with Node.js:

I got a project from a colleague created with ionic and cordova. The app itself is also running, for a special customer, we have adapted the design. My thought was that it was done quickly. I changed my branch in GIT to the corresponding project and wanted to do it. Unfortunately, I get countless error messages and warnings that I did not have in the previous project.

I uninstalled Node.js and reinstalled it completely, unfortunately nothing has changed. I can not uninstall or install any of the packages. I always get this eternally long error message and I do not know exactly what the problem is. Uninstalling Ionic and cordova does not work either, same error message. Below is a listing of my version of Node.js, Ionic and cordova and the beginning and end of the error message.

Console:gitproject user$ git branch
* development
  master
Console:gitproject user$ ionic cordova build
? What platform would you like to build (android, ios): ios
> ionic-app-scripts build --target cordova --platform ios
[08:44:43]  ionic-app-scripts 3.2.3 
[08:44:43]  build dev started ... 
[08:44:43]  clean started ... 
[08:44:43]  clean finished in 24 ms 
[08:44:43]  copy started ... 
[08:44:43]  deeplinks started ... 
[08:44:44]  deeplinks finished in 593 ms 
[08:44:44]  transpile started ... 
[08:44:56]  typescript: src/app/app.component.ts, line: 34 
            Cannot find name 'Globalization'. 

      L33:            private translate: TranslateService,
      L34:            private globalization: Globalization) {
      L35:  platform.ready().then(() => {

[08:44:56]  ionic-app-script task: "build" 
[08:44:56]  Error: Failed to transpile program 
Error: Failed to transpile program
    at new BuildError (/path/to/project/gitproject/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at /path/to/project/gitproject/node_modules/@ionic/app-scripts/dist/transpile.js:159:20
    at new Promise (<anonymous>)
    at transpileWorker (/path/to/project/gitproject/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)
    at Object.transpile (/path/to/project/gitproject/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)
    at /path/to/project/gitproject/node_modules/@ionic/app-scripts/dist/build.js:109:82
[ERROR] An error occurred while running subprocess ionic-app-scripts.

        ionic-app-scripts build --target cordova --platform ios exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
Console:gitproject user$ ionic cordova plugin add cordova-plugin-globalization
> cordova plugin add cordova-plugin-globalization --save
Installing "cordova-plugin-globalization" for ios
Unable to load PlatformApi from platform. Error: Cannot find module 'unorm'
Require stack:
- /path/to/project/gitproject/platforms/ios/cordova/Api.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/util.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/platforms/platforms.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/plugman.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/cordova-lib.js
- /usr/local/lib/node_modules/cordova/src/help.js
- /usr/local/lib/node_modules/cordova/src/cli.js
- /usr/local/lib/node_modules/cordova/bin/cordova
Failed to install 'cordova-plugin-globalization': Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('The platform "ios" does not appear to be a valid ' +
  'cordova platform. It is missing API.js. ios not ' +
  'supported.')
    at CordovaEventEmitter.emit (events.js:185:17)
    at CordovaEventEmitter.emit (/usr/local/lib/node_modules/cordova/node_modules/cordova-common/src/events.js:69:22)
    at Object.getPlatformApiFunction (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/util.js:384:20)
    at Object.getPlatformApi (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/platforms/platforms.js:55:32)
    at handleInstall (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:580:29)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:349:28
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
Unhandled error. ('The platform "ios" does not appear to be a valid ' +
  'cordova platform. It is missing API.js. ios not ' +
  'supported.')
Console:gitproject user$ npm install @ionic-native/globalization

> fsevents@1.2.4 install /path/to/project/gitproject/node_modules/fsevents
> node install

node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v72-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@12.2.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 

...
...
...
...

10 warnings and 8 errors generated.
make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/path/to/project/gitproject/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/path/to/project/gitproject/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /path/to/project/gitproject/node_modules/node-sass
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.9.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /path/to/user/folder/.npm/_logs/2019-05-27T08_04_02_672Z-debug.log

Here is the edition from the above mentioned error log

2653 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
2654 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 install: `node install`
2654 warn optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
2655 verbose optional SKIPPING OPTIONAL DEPENDENCY:
2655 verbose optional Failed at the fsevents@1.2.4 install script.
2655 verbose optional SKIPPING OPTIONAL DEPENDENCY: This is probably not a problem with npm. There is likely additional logging output above.
2656 verbose stack Error: node-sass@4.9.0 postinstall: `node scripts/build.js`
2656 verbose stack Exit status 1
2656 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
2656 verbose stack     at EventEmitter.emit (events.js:200:13)
2656 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
2656 verbose stack     at ChildProcess.emit (events.js:200:13)
2656 verbose stack     at maybeClose (internal/child_process.js:1021:16)
2656 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
2657 verbose pkgid node-sass@4.9.0
2658 verbose cwd /Users/premox/Documents/projects/gitproject
2659 verbose Darwin 18.6.0
2660 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "uninstall" "sass"
2661 verbose node v12.3.1
2662 verbose npm  v6.9.0
2663 error code ELIFECYCLE
2664 error errno 1
2665 error node-sass@4.9.0 postinstall: `node scripts/build.js`
2665 error Exit status 1
2666 error Failed at the node-sass@4.9.0 postinstall script.
2666 error This is probably not a problem with npm. There is likely additional logging output above.
2667 verbose exit [ 1, true ]

Console:gitproject user$ node -v
v12.3.1
Console:gitproject user$ npm -v
6.9.0

Can someone explain this error message to me?

Premox
  • 323
  • 10
  • 25

1 Answers1

0

There are a couple of things you can do in order to setup the project correctly.

  1. Check if node, ionic and cordova are properly installed.

  2. Completely delete the node modules folder and then run the following command:-

    npm install

This would install all the dependencies in the project.

  1. If above doesnot work then you can try, same step mentioned by Ashok to resolve:-

    npm install @ionic/app-scripts@latest --save-dev

Please let me know if you have any questions.