Most probably you might have reached this blog as part of some issues with building, testing and debugging PCF controls which you are working on. I was also getting the same issues but all of a sudden. To be very specific, I started getting this the very moment I started to do a build for my control today morning and seems to be an issue with the pac version of cli (1.7.2) which we are using. the error messages which you might be getting could be something similar to
“Package subpath ‘./v4” is not defined by “exports” in <<your component path>>” along with “pcf-start exited with code 1” with type error “Cannot read property “compileTime” of undefined”. From my experience out of the suggestions by experts it seems to be an issue with the pcf cli v1.7.2 which is installed in our machines and the later version. We have to wait for a newer version for a complete fix. Until then there is a work around for the same which we will discuss in today’s blog. Hope this will help you.
Until we have a newer version of “pac cli” we can try to go back to an older version of our cli component. For that first we need to get a list of versions installed in our machine and then we have to switch to an older version already available in our machine. Its advised to move to version 1.6.6.
pac use pac use 1.6.6 pac install 1.6.6
In the above code segment, the first line of command helps to list all the versions available in our machine and second command can be used to use a specific version. The third or the last one can be used to install the version in case it is not available in our machine. For the build issue which you are facing after downgrading the pac version, we can try to disable the telemetry which could help. For that you can use the below command.
pac telemetry disable
Above commands will help us to get this issue sorted out for for any new projects. In case you have to do something for an existing project, we have to use the below command
npm install email@example.com
As mentioned in the starting, this is just a work around until a newer version of pac is available with a complete fix for this issue which we are facing. By then we might need to use the latest version using the commands below
pac use latest npm install pcf-start@latest
Hope this was helpful in case you spend some time figuring out what could have caused this issue. In case helpful, reference to this is available here. In case you are looking for a step by step process to create pcf control you can check one of my previous blog for that.