Components are not Showing while building the primeng locally

UI Components for Angular
Post Reply
Rohit96na
Posts: 1
Joined: 11 Oct 2021, 08:02

11 Oct 2021, 08:51

hii,

I have downloaded the latest primeng(v12) library from https://github.com/primefaces/primeng. I am using the primeng component and also wanted to add some components also. so, I build the library locally. but when install it it give me error

Error: ../../primeng/dist/button/button.d.ts:4:21 - error TS2307: Cannot find module 'primeng/ripple' or its corresponding type declarations.
4 import * as i2 from "primeng/ripple";

I don't understand, but i think primeng/ripple it's not reading the path.

and also i need help for the library build, if anybody can help will be great

Thanks

lexanred
Posts: 2
Joined: 14 Sep 2022, 23:23

01 Oct 2022, 01:09

Is there any update on this?

I just ran in the same issue.

https://github.com/primefaces/primeng/issues/10723

yigitfindikli closed the issue by forwarding to the forum.

This question is more than a year old and still relevant. A note in the readme or in the wiki about how to build from source and install in a project via NPM would be great.

Actually there is an article in the wiki: https://github.com/primefaces/primeng/w ... rom-Source

But it only describes how to run the showcase application.

Please help us out here. Forking the repo and adding own functionality is crucial for many people.

And since PrimeNG has been forked several thousand times, it must be possible.

Greg9504
Posts: 2
Joined: 22 Nov 2022, 23:40

22 Nov 2022, 23:52

Running into the same problem. Here is what I did:
Forked repo, created a branch off of 14.2.2 tag
ran the build:package script: npm run build:package
everything seemed to build correctly

Created an npm link in the "dist" director of primeng (dist directory is created after running build:package):

C:\src\opensourcejs\primeng\dist>npm link

in terminal of my project that uses primeng link to my local build:

C:\src\TAnalyzeNgx>npm link primeng

Project is now pointing to local build (if you navigate the node_modules\primeng directory it points to the local build).

If I now build my app I get errors similar to above:
Error: ../opensourcejs/primeng/dist/tree/tree.d.ts:2:41 - error TS2307: Cannot find module 'primeng/api' or its corresponding type declarations.

2 import { PrimeNGConfig, TreeNode } from 'primeng/api';
~~~~~~~~~~~~~


Error: ../opensourcejs/primeng/dist/tree/tree.d.ts:3:37 - error TS2307: Cannot find module 'primeng/api' or its corresponding type declarations.

3 import { TreeDragDropService } from 'primeng/api';
What is the missing step to get this to work? FWIW I think I've found a bug and I'm trying to see if my fix works.
Greg.

Greg9504
Posts: 2
Joined: 22 Nov 2022, 23:40

23 Nov 2022, 19:16

OK I sort of having it working. I had to package primeng into a .tgz file first by running the following in the primeng project:

npm install
// (only if running on windows, required for build:package command to work)
npm install cross-env --save-dev
update package.json build:package line from:
"build:package": "BROWSERSLIST_ENV=library ng build primeng-library && gulp build-assets",
to
"build:package": "cross-env BROWSERSLIST_ENV=library ng build primeng-library && gulp build-assets",
// end windows only

npm run build:package
cd dist
npm pack (this builds the .tgz file)

Now if you had previous added a link to the npm global sym links using "npm link" in the primeng project (as I did in the above post) remove it using:
npm unlink primeng -g

Now in the project you use primeng:
remove any link you may have created (as I did in above post), ignore otherwise
npm unlink primeng
if your package.json currently points to primeng, uninstall it:
npm uninstall primeng

now point the project to the .tgz file:
npm install .\pathtolocalprimeng\dist\primeng-14.2.2.tgz

start your app
npm start
should have no compile errors. If you do confirm you have no leftover links:
npm ls -g --link
npm ls --link
You should not see any reference to primeng in either of those commands.
Search your package-lock.json and you should only see references to the tgz file
As a last resort delete node_modules and package-lock.json and run npm install

I'm not sure why pointing at the tgz works by not the dist folder itself, as the .tgz file seems to be just the contents of the dist folder. A bit annoying as now any code change in primeng requires extra steps to test. Would love to know if there is a way to get this work without having to install the .tgz file?
Thanks.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests