ng-packagr: ENOENT: no such file or directory, open .... (but that can not be!!)(please help)

Type of Issue

[x ] Bug Report
[ ] Feature Request

Description

I run into the same issues (see related issues)! But something is really strange! Until yesterday everything worked well but today not. I have changed nothing (no versions updates, etc). That’s really frustrating (i tried it on 2 different work stations). Cant do anything since this morning 😦

ng-packagr does not manage to move (my matmedia files, not some externals, see below header description "which should be packaged") the corresponding files into the out folder during the build process!

When i run ./node_ modules/.bin/ng-packagr i get follow error (see below).

Run command:

$ node_modules/.bin/ng-packagr
Building Angular Package
Building entry point '@honey.glass/matmedia'
Cleaning build directory
Rendering Stylesheets
Rendering Templates
Compiling TypeScript sources through ngc
Bundling to FESM15
Bundling to FESM5
Bundling to UMD
Minifying UMD bundle

BUILD ERROR
ENOENT: no such file or directory, open 'test.honey.glass/.ng_pkg_build/honey.glass-matmedia/out/matmedia.directive.config.ts'
Error: ENOENT: no such file or directory, open 'est.honey.glass/.ng_pkg_build/honey.glass-matmedia/out/matmedia.directive.config.ts'

It seems like it would be a general problem (related issues)

https://github.com/dherges/ng-packagr/issues/590 (im not using v1, but v2 and the same error) https://github.com/dherges/ng-packagr/issues/166 (same issue but something with externals) https://github.com/dherges/ng-packagr/issues/81 (same issue) https://github.com/dherges/ng-packagr/issues/694 (the workaround did not work!) https://github.com/dherges/ng-packagr/issues/174 (suggestion to downgrade, but i cant downgrade) https://github.com/dherges/ng-packagr/issues/434 (umdModuleIds: what does that do? do i really need it)

Folder which should be packaged:

.
β”œβ”€β”€ LICENSE.md
β”œβ”€β”€ README.md
β”œβ”€β”€ dummy.component.ts
β”œβ”€β”€ matmedia.directive.config.ts
β”œβ”€β”€ matmedia.directive.interface.ts
β”œβ”€β”€ matmedia.directive.spec.ts
β”œβ”€β”€ matmedia.directive.ts
β”œβ”€β”€ matmedia.module.ts
β”œβ”€β”€ ng-package.json
β”œβ”€β”€ package.json
β”œβ”€β”€ public_api.ts
└── tslint.json

After Error:

.
β”œβ”€β”€ LICENSE.md
β”œβ”€β”€ README.md
β”œβ”€β”€ dummy.component.ts
β”œβ”€β”€ matmedia.directive.config.ts
β”œβ”€β”€ matmedia.directive.interface.ts
β”œβ”€β”€ matmedia.directive.spec.ts
β”œβ”€β”€ matmedia.directive.ts
β”œβ”€β”€ matmedia.module.ts
β”œβ”€β”€ ng-package.json
β”œβ”€β”€ ng_pkg_build
β”‚Β Β  └── honey.glass-matmedia
β”‚Β Β      β”œβ”€β”€ out
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ honey.glass-matmedia.d.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ honey.glass-matmedia.js
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ honey.glass-matmedia.js.map
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ honey.glass-matmedia.metadata.json
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.config.d.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.config.js
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.config.js.map
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.d.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.interface.d.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.interface.js
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.interface.js.map
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.js
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.directive.js.map
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.module.d.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.module.js
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ matmedia.module.js.map
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ public_api.d.ts
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ public_api.js
β”‚Β Β      β”‚Β Β  └── public_api.js.map
β”‚Β Β      └── stage
β”‚Β Β          β”œβ”€β”€ bundles
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ honey.glass-matmedia.umd.js
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ honey.glass-matmedia.umd.js.map
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ honey.glass-matmedia.umd.min.js
β”‚Β Β          β”‚Β Β  └── honey.glass-matmedia.umd.min.js.map
β”‚Β Β          β”œβ”€β”€ esm2015
β”‚Β Β          β”‚Β Β  β”œβ”€β”€ honey.glass-matmedia.js
β”‚Β Β          β”‚Β Β  └── honey.glass-matmedia.js.map
β”‚Β Β          └── esm5
β”‚Β Β              β”œβ”€β”€ honey.glass-matmedia.js
β”‚Β Β              └── honey.glass-matmedia.js.map
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
β”œβ”€β”€ public_api.ts
└── tslint.json

How To Reproduce

can someone tell me if he gets the same problem with my repo

git clone https://github.com/SerkanSipahi/test.honey.glass.git
cd test.honey.glass
npm install
./node_modules/.bin/ng-packagr

Expected Behaviour

build a package

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr:            2.4.1
@angular/compiler:     5.2.9
@angular/compiler-cli: 5.2.9
rollup:                0.55.5
tsickle:               0.27.5
typescript:            2.5.3

node --version v8.9.4

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 29 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Good news its works now, i have made a quick test!

For a Single Source of Truth i removed all the ~^ symbols from the package.json inside of node_modules/ng-packagr/package.json and run in there npm install! The question is which dependency broke it? we/i have check it one by one (remove one symbol, install, run ng-packagr)!:

Because of thats issues/problems i never use in my projects ~^ symbols in the package.json! I do it manuelly by my self with some helper (npm update, npm-check-updates) tools. This is more safe! Especially with popular projects you should be careful.

can anyone confirm my quick test?

...
...
  "dependencies": {
    "@ngtools/json-schema": "1.1.0",
    "autoprefixer": "7.1.1",
    "browserslist": "2.1.5",
    "chalk": "2.3.1",
    "commander": "2.12.0",
    "cpx": "1.5.0",
    "fs-extra": "5.0.0",
    "glob": "7.1.2",
    "injection-js": "2.2.1",
    "less": "2.7.2",
    "node-sass": "4.5.3",
    "node-sass-tilde-importer": "1.0.0",
    "postcss": "6.0.2",
    "postcss-clean": "1.1.0",
    "postcss-url": "7.3.0",
    "read-pkg-up": "3.0.0",
    "rimraf": "2.6.1",
    "rollup": "0.55.0",
    "rollup-plugin-cleanup": "2.0.0",
    "rollup-plugin-commonjs": "8.3.0",
    "rollup-plugin-license": "0.6.0",
    "rollup-plugin-node-resolve": "3.0.0",
    "rxjs": "5.5.0",
    "sorcery": "0.10.0",
    "strip-bom": "3.0.0",
    "stylus": "0.54.5",
    "tar": "4.4.1",
    "uglify-js": "3.0.7",
    "update-notifier": "2.3.0"
  },
....
....

@alan-agius4 thank you for the PR!

@sebastianscatularo Thanks, im investigating which dependency broke the packagr!

I have a similar problem, in my case the culprit seems to be uglify-js, when I replace it with a project that works (from yesterday) it works.

Broken version 3.3.20 Working version 3.3.18

Thanks for the quick fix! This was killing all our builds!

Not to be pedantic, but I’m wondering … is there a unit/integration test that can be added to detect these earlier? Not sure how this project is setup with Jenkins CI builds doing that type of thing …

Update: The build process is working when we explicitly set includeSources to truein https://github.com/dherges/ng-packagr/blob/4da00524acfd159d0c1eb725396eab74e123d7f2/src/lib/flatten/uglify.ts#L20-L23

By setting it, it behaves correct!

See related ticket: https://github.com/mishoo/UglifyJS2/issues/3063

What to do? Creating a MR with that setting (includeSources=true)?