I followed this tutorial by Nikolas LeBlanc for building an Angular 4 Component Library. The tutorial describes a way to reuse a module in another project by packaging one project and installing it in the other.
First, this are my software versions:
I can't follow the tutorial further than the heading "Create our package", because executing the following command:
ng-packagr -p ng-package.json
When executing this command the following error will occur:
npm run forestrun
[email protected] forestrun C:\Users\Kevin.DeGoede\Documents\yoyo\bte
ng-packagr -p ng-package.json
Building Angular Package
Building entry point 'bte'
Cleaning build directory
Rendering Stylesheets
Rendering Templates
Compiling TypeScript sources through ngc
Bundling to FESM15
Bundling to FESM5
Bundling to UMD
Minifying UMD bundle
Relocating source maps
Copying staged files
Writing package metadata
Distributing npm packages with 'dependencies' is not recommended. Please consider adding to 'peerDependencies' or remove it from 'dependencies'.
BUILD ERROR
EPERM: operation not permitted, unlink 'C:\Users\Kevin\Documents\yoyo\bte\dist\src\app\modules'
Error: EPERM: operation not permitted, unlink 'C:\Users\Kevin\Documents\yoyo\bte\dist\src\app\modules'
npm ERR! code ELIFECYCLE
npm ERR! errno 111
npm ERR! [email protected] forestrun: ng-packagr -p ng-package.json
npm ERR! Exit status 111
npm ERR!
npm ERR! Failed at the [email protected] forestrun script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Kevin\AppData\Roaming\npm-cache_logs\2018-05-04T08_30_30_818Z-debug.log
When trying again the following error occurs:
npm run forestrun
[email protected] forestrun C:\Users\Kevin\Documents\yoyo\bte
ng-packagr -p ng-package.json
Building Angular Package
glob error { Error: EPERM: operation not permitted, scandir 'C:\Users\Kevin\Documents\yoyo\bte\dist\src\app\modules'
errno: -4048,
code: 'EPERM',
syscall: 'scandir',
path: 'C:\Users\Kevin\Documents\yoyo\bte\dist\src\app\modules' }
BUILD ERROR
EPERM: operation not permitted, scandir 'C:\Users\Kevin\Documents\yoyo\bte\dist\src\app\modules'
Error: EPERM: operation not permitted, scandir 'C:\Users\Kevin\Documents\yoyo\bte\dist\src\app\modules'
npm ERR! code ELIFECYCLE
npm ERR! errno 111
npm ERR! [email protected] forestrun: ng-packagr -p ng-package.json
npm ERR! Exit status 111
npm ERR!
npm ERR! Failed at the [email protected] forestrun script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Kevin\AppData\Roaming\npm-cache_logs\2018-05-04T08_54_07_739Z-debug.log
I tried it also on my Mac, but everything works fine, but we all work on windows machines. So how can I get the ng-packagr to work on my windows machine?
You can try run command line on behalf of the administrator. Maybe will help