Skip to content
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

Slim v4 image failed to build with node #337

Open
afdolriski opened this issue Oct 4, 2022 · 3 comments
Open

Slim v4 image failed to build with node #337

afdolriski opened this issue Oct 4, 2022 · 3 comments
Labels
bug confirmed Bug reproduced and qualified

Comments

@afdolriski
Copy link

Expected Behavior

Using this Dockerfile:

ARG NODE_VERSION=12
FROM thecodingmachine/php:7.4-v4-slim-fpm

The build should be finished without error and having node 12 installed.

Current Behavior

The build process will produce an error:

npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules/npm/node_modules/abbrev'

Possible Solution

I imagine 2 options:

  1. On slim file remove this command:
npm install -g npm
  1. Modify default directory, source: npm

Steps to Reproduce (for bugs)

  1. Use Dockerfile provided above
  2. Run build docker build . -t slim-image
@f3l1x
Copy link

f3l1x commented Oct 31, 2022

Same issue at me.

ARG NODE_VERSION=18
FROM thecodingmachine/php:8.0-v4-slim-apache
#8 31.07 The following NEW packages will be installed:
#8 31.07   yarn
#8 31.29 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
#8 31.29 Need to get 893 kB of archives.
#8 31.29 After this operation, 5415 kB of additional disk space will be used.
#8 31.29 Get:1 https://dl.yarnpkg.com/debian stable/main amd64 yarn all 1.22.19-1 [893 kB]
#8 31.52 debconf: delaying package configuration, since apt-utils is not installed
#8 31.54 Fetched 893 kB in 0s (2604 kB/s)
#8 31.60 Selecting previously unselected package yarn.
(Reading database ... 17884 files and directories currently installed.)
#8 31.61 Preparing to unpack .../yarn_1.22.19-1_all.deb ...
#8 31.61 Unpacking yarn (1.22.19-1) ...
#8 31.88 Setting up yarn (1.22.19-1) ...
#8 33.02 npm ERR! code EACCES
#8 33.02 npm ERR! syscall rename
#8 33.02 npm ERR! path /usr/lib/node_modules/npm
#8 33.02 npm ERR! dest /usr/lib/node_modules/.npm-qUIFSsiV
#8 33.02 npm ERR! errno -13
#8 33.02 npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm-qUIFSsiV'
#8 33.02 npm ERR!  [Error: EACCES: permission denied, rename '/usr/lib/node_modules/npm' -> '/usr/lib/node_modules/.npm-qUIFSsiV'] {
#8 33.02 npm ERR!   errno: -13,
#8 33.02 npm ERR!   code: 'EACCES',
#8 33.02 npm ERR!   syscall: 'rename',
#8 33.02 npm ERR!   path: '/usr/lib/node_modules/npm',
#8 33.02 npm ERR!   dest: '/usr/lib/node_modules/.npm-qUIFSsiV'
#8 33.02 npm ERR! }
#8 33.02 npm ERR!
#8 33.02 npm ERR! The operation was rejected by your operating system.
#8 33.02 npm ERR! It is likely you do not have the permissions to access this file as the current user
#8 33.02 npm ERR!
#8 33.02 npm ERR! If you believe this might be a permissions issue, please double-check the
#8 33.02 npm ERR! permissions of the file and its containing directories, or try running
#8 33.02 npm ERR! the command again as root/Administrator.
#8 33.02
#8 33.02 npm ERR! A complete log of this run can be found in:
#8 33.02 npm ERR!     /home/docker/.npm/_logs/2022-10-31T10_23_52_154Z-debug-0.log

@afdolriski
Copy link
Author

For anyone having same problem, you can use this image instead for temporary fix:

FROM thecodingmachine/php:7.4.29-v4-slim-fpm

@mistraloz mistraloz added the bug confirmed Bug reproduced and qualified label Nov 3, 2022
@mistraloz
Copy link
Collaborator

Hum i think we can just change

ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \
    sudo apt-get update && \
    sudo apt-get install -y --no-install-recommends gnupg && \
    curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | sudo bash - && \
    sudo apt-get update && \
    sudo apt-get install -y --no-install-recommends nodejs && \
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - && \
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && \
    sudo apt-get update && \
    sudo apt-get install -y --no-install-recommends yarn && \
-    if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \
+    if [[ "${NODE_VERSION}" == "10" ]]; then sudo npm install -g npm@^6.14; fi && \
    sudo apt-get clean && \
    sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*; \
    fi;

I think there are more issue related to npm install but we will more to v5 in few month so maybe we can use this quickfix for instance.

@mistraloz mistraloz mentioned this issue Nov 3, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed Bug reproduced and qualified
Projects
None yet
Development

No branches or pull requests

3 participants