Skip to main content

Notifications

Community site session details

Community site session details

Session Id : AkdyIdQYEmGdVs4+c1k2bH
Power Pages - Power Apps Portals
Suggested answer

Getting an error running pac

Like (0) ShareShare
ReportReport
Posted on 21 Feb 2025 08:13:53 by
 pac
fs.js:42
} = primordials;
    ^
ReferenceError: primordials is not defined
    at fs.js:42:5
    at req_ (/Users/atreyarunsinainadkarni/.nvm/versions/node/v16.20.2/lib/node_modules/pac/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Users/atreyarunsinainadkarni/.nvm/versions/node/v16.20.2/lib/node_modules/pac/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Users/atreyarunsinainadkarni/.nvm/versions/node/v16.20.2/lib/node_modules/pac/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
 
tried older node versions, runninng on mac
Categories:
  • Suggested answer
    Inogic Profile Picture
    968 Super User 2025 Season 1 on 21 Feb 2025 at 13:26:45
    Getting an error running pac
    Hi,
     
    It seems like you're encountering an issue with the primordials error, which is common when trying to run older packages (such as pac) on a newer version of Node.js. This happens because the primordials reference was removed in newer versions of Node.js, and certain libraries (like older versions of graceful-fs or pac) still depend on it.

    Here’s how you can resolve this:

    Solution 1: Upgrade the pac package

    If possible, try upgrading the pac package to the latest version. Newer versions of pac may have fixed this issue to work with modern Node.js versions.
    1. Check for updates:
      Run the following command to check if there's an update for pac:
      npm outdated pac
    2. Update the package:
      If an update is available, you can upgrade it by running:
      npm install -g pac

    OR
    Solution 2: Downgrade Node.js to a compatible version
    If you're unable to update pac, you can use a Node.js version that is compatible with your current pac version. The error is typically associated with Node.js v12 and later, so downgrading to Node.js v10 should resolve the issue.
    You can use nvm to switch to Node.js v10:
    1. Install Node.js v10 using nvm:
    nvm install 10
    nvm use 10
    1. Re-run pac and check if the error still occurs.

    OR
    Solution 3: Apply a patch for graceful-fs
    If you can't update pac or downgrade Node.js, you could manually patch the issue by upgrading the graceful-fs dependency inside the pac package:
    1. Navigate to the pac package directory:
    cd /Users/atreyarunsinainadkarni/.nvm/versions/node/v16.20.2/lib/node_modules/pac
    1. Install a newer version of graceful-fs:
    npm install graceful-fs@latest
    1. Try running pac again.
    OR
    Solution 4: Use the natives package workaround
    In some cases, the issue might be resolved by installing the natives package that is compatible with your Node.js version.
    1. Install natives package:
    npm install natives
    1. Try running pac again.
    Hope this helps.
     

    Thanks!

    Inogic Professional Services: Power Platform/Dynamics 365 CRM
    An expert technical extension for your techno-functional business needs
    Service: https://www.inogic.com/services/ 
    Tips and Tricks: https://www.inogic.com/blog/ 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started