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

Issue when deploying code #55

Open
Shayner2005 opened this issue Jun 27, 2020 · 1 comment
Open

Issue when deploying code #55

Shayner2005 opened this issue Jun 27, 2020 · 1 comment

Comments

@Shayner2005
Copy link

While following the guide, I used

git push balena master

Step 1/9 : FROM balenalib/raspberrypi3-node:12-run
---> 64d4d9c241bb
Step 2/9 : RUN mkdir -p /usr/src/app/
Using cache
---> 3ef7c60c0903
Step 3/9 : WORKDIR /usr/src/app
Using cache
---> 3ff15989b2e6
Step 4/9 : COPY ./app/package.json ./
Using cache
---> 8d66e136d718
Step 5/9 : RUN npm install --unsafe-perm -g node-file-manager
---> Running in 30b017403de0
npm ERR! code ENOENT

npm ERR! syscall chmod
npm ERR! path /usr/local/lib/node_modules/node-file-manager/node-file-manager/bin/node-file-manager.sh
npm ERR!
errno -2

npm ERR!

enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/node-file-manager/node-file-manager/bin/node-file-manager.sh'

npm ERR!
enoent This is related to npm not being able to find a file.
npm
ERR!
enoent

npm
ERR!
A complete log of this run can be found in:
npm
ERR!
/root/.npm/_logs/2020-06-27T19_10_35_184Z-debug.log

The command '/bin/sh -c npm install --unsafe-perm -g node-file-manager' returned a non-zero code: 254

[Info] Uploading images
[Success] Successfully uploaded images
[Error] Some services failed to build:
[Error] Service: file-manager
[Error] Error: The command '/bin/sh -c npm install --unsafe-perm -g node-file-manager' returned a non-zero code: 254
[Info] Built on arm01
[Error] Not deploying release

Any way to fix this?
Thanks

This was referenced Nov 25, 2020
@StealthyCoder
Copy link

I fixed it by changing two things.

Inside file-manager/Dockerfile.template

This changes the installation from the npm registry which fails, to downloading the git repo and installing locally to /opt/node-file-manager-master. Subsequently it is necessary to call the binary from this path rather than using the globally install binary previously obtained.

FROM balenalib/%%BALENA_MACHINE_NAME%%-node:12-run

# Move to app dir
RUN mkdir -p /usr/src/app/
WORKDIR /usr/src/app
COPY ./app/package.json ./

RUN apt update && \
    apt install wget unzip -y --no-install-recommends && \
    cd /opt && wget https://github.com/efeiefei/node-file-manager/archive/master.zip && \
    unzip master.zip && rm master.zip && \
    cd node-file-manager-master && \
    npm i
RUN JOBS=MAX npm install --unsafe-perm --production
RUN npm cache clean --force && rm -rf /tmp/*

# Move app to filesystem
COPY ./app ./

# Start app
CMD ["bash", "/usr/src/app/start.sh"]

Inside file-manager/app/index.js

I changed the line of the const filemanager into the following one:
const filemanager = spawn('node', ['/opt/node-file-manager-master/lib/index.js','-p', '8000', '-d', '/data/mopidy/media']);

This fixes the building of this image for me, but I have not been able to test the actual execution because I faced another error with raspotify. It does not run on Buster and not on arm64 (aarch64) only armhf, so I am recompiling it on aarch64 and supplying my own binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants