-1

I want to add NPM's dependency in Dockerfile like that:

RUN PATH="/node_modules/@zxc/pdm-node-builds/dist/bin/pdm-node-scripts.js:$PATH"
RUN export PATH

RUN echo $PATH

But it does not work, any other idea?

EDIT: My issue was I had:

RUN PATH="/node_modules/@zxc/pdm-node-builds/dist/bin/pdm-node-scripts.js:$PATH" 

where should be:

RUN PATH="node_modules/@zxc/pdm-node-builds/dist/bin/pdm-node-scripts.js:$PATH"
0

1 Answer 1

1

Use the ENV instruction to set environment variables in a Dockerfile. You also don't need the export statement in this case.

ENV PATH="/node_modules/@zxc/pdm-node-builds/dist/bin/pdm-node-scripts.js:$PATH"
RUN echo $PATH

EDIT: If your script is called pdm-node-scripts.js and it's located in /node_modules/@zxc/pdm-node-builds/dist/bin, then you should be adding the directory i.e. /node_modules/@relayr/pdm-node-builds/dist/bin to PATH, not the executable itself.

Sign up to request clarification or add additional context in comments.

4 Comments

But still I get "/bin/sh: ./pdm-node-scripts: not found" which means there is no such library in the PATH ;/
That sounds like a different issue. If this pdm-node-scripts executable is in a directory in your PATH, then you shouldn't have ./ in front of it to execute it. If it's in your current working directory, then you need the ./ (and you don't need to add it to PATH)
You might be adding the wrong thing to PATH. Check the edited answer.
Yes, I agree. I know it. Fight to work it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.