pantonis
pantonis

Reputation: 6487

Error when trying to reference a github repository

I am using angular 2 and I am trying to reference a github repo directly instead of an npm package in order to debug but the project does not compile. In my packages.json I changed "primeng": "4.2.2", with "primeng": "git+https://github.com/primefaces/primeng.git"

When I build I get following errors

ERROR in multi ./node_modules/simple-line-icons/css/simple-line-icons.css ./node_modules/font-awesome/css/font-awesome.css ./node_modules/famfamfam-flags/dist/sprite/famfamfam-flags.css ./node_modules/bootstrap-select/dist/css/bootstrap-select.css ./node_modules/jquery.uniform/dist/css/default.css ./node_modules/toastr/build/toastr.css ./node_modules/sweetalert/dist/sweetalert.css ./node_modules/jstree/dist/themes/default/style.min.css ./node_modules/jtable/lib/themes/metro/blue/jtable.min.css ./node_modules/morris.js/morris.css ./node_modules/bootstrap-daterangepicker/daterangepicker.css ./node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css ./src/app/shared/core.less ./src/app/shared/layout/layout.less ./src/assets/bootstrap-datepicker/css/bootstrap-datepicker.min.css ./node_modules/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css ./src/styles.css ./src/fonts.css ./src/Test-palette.css ./src/app/risk-management/styles/module-styles.css ./src/primeng-chips.css ./src/primeng-datatable.css ./src/primeng-multiselect.css ./src/primeng-sidebar.css ./src/animations.css ./node_modules/primeng/resources/primeng.min.css ./node_modules/primeng/resources/themes/redmond/theme.css ./node_modules/@angular/material/prebuilt-themes/indigo-pink.css ./node_modules/loaders.css/loaders.min.css
Module not found: Error: Can't resolve 'C:\SourceControl\Test\TestProject\src\TestProject.Client\node_modules\primeng\resources\primeng.min.css' 

When I check the node modules/primeng I only see these files:

enter image description here

What am I doing wrong?

Upvotes: 0

Views: 105

Answers (2)

Estus Flask
Estus Flask

Reputation: 222864

NPM primeng package was built for distribution and has resources directory, while Github repository contains only source files. This is very common among NPM packages.

Since Github repo source is used for the purpose of debugging, the solution is to build the package manually. Considering that resources are built with Gulp and not generic NPM build script, it should be something like:

cd ./node_modules/primeng
npm i
gulp build-assets

Upvotes: 1

Martin Adámek
Martin Adámek

Reputation: 18409

You do not need the github.com prefix there, this should be enough:

"primeng": "primefaces/primeng"

More about this here: https://docs.npmjs.com/files/package.json#github-urls

Problem is that the resources folder is ignore via .gitignore. There is a gulpfile.js, that is responsible for creating it. You could run that manually if you want to use github version directly.

https://github.com/primefaces/primeng/blob/master/gulpfile.js

Upvotes: 1

Related Questions