question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Building library in the node_modules folder

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

the same issue that was created here #1635

How To Reproduce

ng new example-workspace --createApplication=false
...
cd example-workspace
ng g lib example-lib
...
ng g app example-app
...
ng build example-app
⠋ Generating browser application bundles (phase: setup)...Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
✔ Browser application bundle generation complete.
✔ Copying assets complete.
✔ Index html generation complete.

Initial Chunk Files               | Names         |      Size
main.0269233762bca8b97745.js      | main          |  65.65 kB
polyfills.71710c1bb70c21ce05f9.js | polyfills     |  35.96 kB
runtime.5e9671802f9984a7370d.js   | runtime       |   1.02 kB
styles.31d6cfe0d16ae931b73c.css   | styles        |   0 bytes

                                  | Initial Total | 102.63 kB

Build at: 2021-06-13T22:31:06.741Z - Hash: 274b099bb8150898c634 - Time: 17160ms

ng build example-lib
Building Angular Package

------------------------------------------------------------------------------
Building entry point 'example-lib'
------------------------------------------------------------------------------
✔ Compiling TypeScript sources through NGC
✖ Bundling to FESM2015
ERROR: Could not resolve './lib/example-lib.service' from dist/example-lib/esm2015/public-api.js
An unhandled exception occurred: Could not resolve './lib/example-lib.service' from dist/example-lib/esm2015/public-api.js
See "/tmp/ng-FJJ26J/angular-errors.log" for further details.

cat /tmp/ng-FJJ26J/angular-errors.log
[error] Error: Could not resolve './lib/example-lib.service' from dist/example-lib/esm2015/public-api.js
    at error (/home/user/work/angular/node_modules/example-workspace/node_modules/rollup/dist/shared/rollup.js:7917:30)
    at ModuleLoader.handleResolveId (/home/user/work/angular/node_modules/example-workspace/node_modules/rollup/dist/shared/rollup.js:19602:24)
    at /home/user/work/angular/node_modules/example-workspace/node_modules/rollup/dist/shared/rollup.js:19551:22
    at async Promise.all (index 0)
    at async ModuleLoader.fetchStaticDependencies (/home/user/work/angular/node_modules/example-workspace/node_modules/rollup/dist/shared/rollup.js:19549:34)
    at async Promise.all (index 0)
    at async ModuleLoader.fetchModule (/home/user/work/angular/node_modules/example-workspace/node_modules/rollup/dist/shared/rollup.js:19525:9)
    at async Promise.all (index 0)
    at async ModuleLoader.fetchStaticDependencies (/home/user/work/angular/node_modules/example-workspace/node_modules/rollup/dist/shared/rollup.js:19549:34)
    at async Promise.all (index 0)

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr:            12.0.5
@angular/compiler:     12.0.4
rollup:                2.51.2
typescript:            4.2.4

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kryshaccommented, Jul 1, 2021

@dnedelko unfortunately not, I put the dist folder on my git

0reactions
github-actions[bot]commented, Aug 1, 2021

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the purpose of the 'node_modules' folder?
It just a directory created by npm and a way of tracking each packages you install locally via package.json . If you had...
Read more >
node_modules folder is always marked as "library root" with ...
The "node_modules" folder should be intelligently marked as "library root" ... (8/16/16 build), my application code inside the 2nd node_modules folder is no ......
Read more >
How to make the node_modules folder accessible during the ...
Hi SAP Community, I want to build an open UI5 theme-library using the ui5 tooling (CLI). This is normally no problem, but I...
Read more >
What's Really Going On Inside Your node_modules Folder?
Suitable for distributing installations, miners, creating a botnet Start ... It's also the reason why your node_modules folder is one of the ...
Read more >
CommonJS modules | Node.js v19.3.0 Documentation
js REPL, it might be useful to also add the /usr/lib/node_modules folder to the $NODE_PATH environment variable. Since the module lookups using node_modules ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found