ReferenceError: primordials is not defined in demo application

I picked the Vue demo app when setting up a new AppFlow project.

Clone’d and “npm install” went fine. However ‘serve’ is broken.

I’ve not changed anything.

tchiverton@noctua:~/workspace/patient-pass-image-upload$ ionic serve

ReferenceError: primordials is not defined
   at evalmachine.<anonymous>:47:5                                                                                             
   at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/vinyl-fs/node_modules/gracef
ul-fs/fs.js:11:1)                                                                                                                 
   at Module._compile (node:internal/modules/cjs/loader:1101:14) 
   at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) 
   at Module.load (node:internal/modules/cjs/loader:981:32) 
   at Function.Module._load (node:internal/modules/cjs/loader:822:12) 
   at Module.require (node:internal/modules/cjs/loader:1005:19) 
   at require (node:internal/modules/cjs/helpers:102:18) 
   at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/vinyl-fs/node_modules/graceful-fs/graceful-fs.js:3:27)                       
   at Module._compile (node:internal/modules/cjs/loader:1101:14) 
primordials is not defined (CLI v1.7.16)

Your system information:

Cordova CLI: Not installed
Gulp version: CLI version: 2.2.0
Gulp local:  Local version: 4.0.2
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS: Distributor ID:     Ubuntu Description:     Ubuntu 20.04.3 LTS
Node Version: v16.13.2

npm run serve does work however. I dunno what the difference is. Is there one ?

I did npm install -g ionic which worked, but has made no difference.

sudo npm install ionic to upgrade that had no effect

neither did node.js - I get the error: fs.js:36 } = primordials; ^ ReferenceError: primordials is not defined - Stack Overflow but that’s from a year ago

uninstalling my global gulp removed those two lines from the information list, but not other change.

sudo npm install -g @ionic/cli ← no change

sudo rm -rf `which ionic` /usr/local/bin/ionic
sudo npm install -g @ionic/cli

And now ionic serve says

[ERROR] Cannot perform serve.
        
        Since you're using the Vue project type, you must provide the ionic:serve npm script so the Ionic CLI can serve
        your project.

which doesn’t mean much to me.

ionic’s help page doesn’t suggest any options or other ways to run things.

Turns out the demo project is missing the fixes from Allow package.json to define what "ionic build" and "ionic serve" do in custom projects · Issue #3819 · ionic-team/ionic-cli · GitHub - ionic serve works now

But it’s also missing from other core examples like tutorial-photo-gallery-vue/package.json at da09a5b50295556d247b23c9cdd10591ed6a0c3a · ionic-team/tutorial-photo-gallery-vue · GitHub so IDK what is going on with it.

Helllo! So it seems you have some very out of date deps (which make sense since you are pointing to the old Ionic CLI package).

npm uninstall -g ionic
npm install -g @ionic/cli

As for the [ERROR] Cannot perform serve. warning, I’d start off by deleteing the local node_modules and package-lock and try to reinstall the projects deps again.

rm -rf package-lock.json node_modules
npm install

This will at least get you to a updated starting point.

Can you provide your package.json please?

Best not to use sudo for all of this. Likely you are going down a rabbit hole very difficult to track back from

If you wnat me to mess with the whole O/S permissions, just so I can globally install Node modules without using sudo, we’re going to have a very short conversation @Tommertom

@mharrison yes, see above, I found that issue, and had to use a big hammer to provide it to upgrade.

So it works now, but I’ve no idea how to report the bug in the AppFlow demo application so that it really does Just Work rather than needing to hand tweak the package.json

@chiverton - I don’t think that is what I am trying to say, neither do I believe you should use profanity in any message. I will leave it up to you to edit the post so the conversation may go on in a more constructive way - hopefully leading to a solution to your problem.

Ya never stubbed your toe ? :slight_smile:

Closing as the discussion is getting heated. @chiverton Please try to keep the language civil here.