Loading...

PCF Control compile error : Cannot find module 'ajv/dist/compile/codegen'

PCF Control compile error : Cannot find module 'ajv/dist/compile/codegen'

I was working on a new PCF control project and I encountered an unexpected error when attempting to build the project, even though no custom code had been added yet. (Cannot find module ajv/dist/compile/codegen)

For reference, I’m using the latest version ( at the time of writing) of the Microsoft Power Platform CLI ( 1.21.4+g4869036) and here are the steps to reproduce :

  1. Execute the init method of the pac cli. This will scaffold a new PCF control projects with all the basic dependencies.
  2. Execute npm install to download the dependencies
  3. Try to build the project : npm run build
  4. ❌Fails with error : Cannot find module “ajv/dist/compile/codegen”
pac pcf init -ns <Namespace> -n <ProjectName> -t field
npm install
npm run build

The error message is quite straitforward and points toward a node module that cannot be found : ajv/dist/compile/codegen . Upon checking the node_modules directory, even if the ajv module seems present, the compile/codegen part is nowhere to be found.

Published on:

Learn more
Need help with this product?

We can help you with PCF Control compile error : Cannot find module 'ajv/dist/compile/codegen'

If you want help implementing, troubleshooting, or improving this product, contact us and we’ll point you in the right direction.

It Must Be Code! - Verses and rants on Power Platform development by David Rivard
It Must Be Code! - Verses and rants on Power Platform development by David Rivard

Verses and rants on Power Platform development by David Rivard

Share post:

Related posts

PCF Controls Tips & Tricks: How to Bundle and Resolve Static JSON Files

JSON files are one of the most common and convenient ways to store structured data. They’re lightweight, human-readable, and easy to parse in ...

11 months ago

PCF Controls Tips and Tricks : How to skip Linting at Build-Time

Have you ever been unable to properly build a PCF control because of linting errors? Well, lately I have, and it can get really frustrating. E...

1 year ago

PCF Controls Tips & Tricks : How to detect Authoring Mode

When you configure a PCF control on a Dataverse model-driven app, the form designer will try to render the control even though it’s not ...

1 year ago

How to Create Deep Links to D365 F&O Records with Dataverse Virtual Tables

It is a common requirement for SaaS platform that exposes form over data to be able to share a secure link (a.k.a. Deep Link) to access a give...

1 year ago

Model-Driven App Trick : How to Hide a Ribbon Button when the Form is Dirty

I recently encountered a requirement on a model-driven app project to display a custom ribbon button only when the form had no unsaved changes...

1 year ago

Newsletter

Get the latest Dynamics 365 and Power Platform content in your inbox

A curated digest of community blogs, product news, videos, and podcasts — delivered without the noise.

Weekly updates Unsubscribe anytime Fresh community picks
We use your email only for the newsletter and you can unsubscribe at any time.
By subscribing, you agree to the privacy policy.