microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.82k stars 594 forks source link

[rush] rush deploy missing node_modules/.bin folder when `"linkCreation": "script"` #2846

Open paynecodes opened 3 years ago

paynecodes commented 3 years ago

Summary

When using rush deploy with linkCreation: default, everything appears correct in the common/deploy folder. Once I copy the contents of this folder into my docker container and execute the container, I get missing dependency errors. I assume docker is having trouble with the symlinks. After running rush deploy with "linkCreation": "script" deploy.json option, I execute the create-script.js file with node create-scripts.js create, but there is no node_modules/.bin folder anymore.

Repro steps

Run rush deploy with "linkCreation": "script". See missing .bin folder where expected

Standard questions

Question Answer
@microsoft/rush globally installed version? 5.47.0
rushVersion from rush.json? 5.47.0
useWorkspaces from rush.json? yes
Operating system? Mac
Would you consider contributing a PR? Don't understand codebase
Node.js version (node -v)? 14.16.0
octogonz commented 3 years ago

This is issue was originally tracked by https://github.com/microsoft/rushstack/issues/1982 which got closed when it was fixed for the other "linkCreation" modes.

In https://github.com/microsoft/rushstack/issues/1982#issuecomment-653223979 I proposed a couple options for how to implement it. It was discussed further in Zulip chat #219557609 which suggests where to start, if someone wants to help by doing some experiments to figure out a reliable way to generate the scripts.

My sense is that the solution is not difficult, and the PR may be small. It's just not high enough priority for the maintainers to work on it. If someone from the community could help push this along, that would be much appreciated. (We can provide guidance and answer questions, just ask in #contributor-helpline.)

paynecodes commented 2 years ago

I misspoke about linkCreation: default behaving correctly. For all node_modules/.bin files, NODE_PATH includes absolute paths on the host.

The docs for rush deploy state the following:

The rush deploy command calculates this set of files and copies them to a target folder, which you can then upload to your server.

Without proper bin link handling for linkCreation: default and linkCreation: script there is currently no way to use rush deploy when bin is needed.

This issue has been been affixed with the enhancement label. Shouldn't it be changed to bug? Semantics aside, how are teams currently using rush deploy without this being fixed?

Synopsis

When deploying with linkCreation: default all node_modules/bin files set NODE_PATH using absolute paths from the host, so you can't simply "upload to your server".

When deploying with linkCreation: script there are no node_modules/bin files at all, so you can't simply "upload to your server".

rorymalcolm commented 2 years ago

Is there any update on this issue? How can I build a Dockerfile from a built NextJS app without copying the next binary?