-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] 10.5.2 regresses running scripts from workspaces in certain Dockerfiles with error No workspaces found
#7413
Comments
This issue also exists in |
First off special thanks to @jAg-upfort for documenting this bug so well with an example 🤘 🏆
I created a docker file so I could ssh into a linux environment: SSHable docker node 20 instance# Use an official Node.js runtime as the base image
FROM node:20
# Install OpenSSH server
RUN apt-get update && apt-get install -y openssh-server
# Set root password
RUN mkdir /var/run/sshd \
&& echo 'root:root' | chpasswd \
&& useradd -m test \
&& passwd -d test \
&& sed -i'' -e's/^#PermitRootLogin prohibit-password$/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed -i'' -e's/^#PasswordAuthentication yes$/PasswordAuthentication yes/' /etc/ssh/sshd_config \
&& sed -i'' -e's/^#PermitEmptyPasswords no$/PermitEmptyPasswords yes/' /etc/ssh/sshd_config \
&& sed -i'' -e's/^UsePAM yes/UsePAM no/' /etc/ssh/sshd_config
# Install NVM
ENV NVM_DIR /root/.nvm
RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
COPY example/package.json /package.json
COPY example/packages/alpha/package.json /packages/alpha/package.json
# Expose port 22 for SSH access
EXPOSE 22
# Start SSH server
CMD ["/usr/sbin/sshd", "-D"] Script to control docker kill / build / run / sshif [[ "$1" == "kill" ]]; then
docker stop $(docker ps -q)
exit 0
elif [[ "$1" == "build" ]]; then
docker build --progress=plain -t npm-ssh -f ./Dockerfile.ssh .
exit 0
elif [[ "$1" == "run" ]]; then
docker run -v ./cli:/cli -d -p 2222:22 npm-ssh
exit 0
elif [[ "$1" == "ssh" ]]; then
ssh root@localhost -p 2222
fi I copied Then I cloned the cli so we can add it as a volume in docker. git clone git@github.com:npm/cli.git && cd cli && node scripts/resetdeps.js && ./bin/npm-cli.js I checked out git checkout tags/v10.5.1 This got docker into a state where I could run the npm /cli/bin/npm-cli.js run --workspace=packages/alpha build Because
And 🎉💥 the offending commit Package Repo: https://github.com/npm/map-workspaces Knowing what we knew about the issue being tied to the root directory. I could litter that file with It turns out that
This would seem to be an inconsistency with the A simple fix on our end would be to remove the proceeding slash npm/map-workspaces#149 |
Hey folks, Apologies for the late reply, as i was on vacation, and thank you so much for not only looking at it quickly but also putting together a fix. Unfortunately I do not believe the fix above is sufficient for completely resolving the issue. I ran the I updated the package.json to include a command for 10.8.0 and I added
|
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm as of version 10.5.2 no longer lets you run scripts in a workspace package.json if your project is located at
/
. I've confirmed it worked in 10.5.1.the specific error is
I've included a zipped project, the 4 individual files and a screenshot of the project with all the files in their entirety visible. The top level package.json has scripts to build the dockerfile in ways that show the bug and that it's a regression.
npm-bug-example.zip
package.json
Dockerfile.txt
package-lock.json
package.json
Expected Behavior
The Dockerfile should build, and not fail due to being unable to find the workspace. This works successfully in 10.5.1, but does not work in 10.5.2
Steps To Reproduce
Both validations assume the project has been unzipped from the uploaded archive or recreated with the raw files in the right places, that docker is installed, and that the testing environment has an internet connection for downloading the base docker images.
I have personally only run this on an Ubuntu system, so Windows or mac users might have other setup requirements.
To validate the issue:
npm run npm-bad
To validate that things work in 10.5.1:
npm run npm-good
Environment
node:iron
andnode:hydrogen
dockerfiles use, but i've also recreated the issue withubuntu:jammy
andpostgres:15-bullseye
for shigglesas part of debugging the issue in my actual environmentThe text was updated successfully, but these errors were encountered: