strapi / strapi-docker

Install and run your first Strapi project using Docker
https://strapi.io
MIT License
1.17k stars 446 forks source link

npm run build fails when using in a docker container #125

Closed avxkim closed 4 years ago

avxkim commented 5 years ago

Strapi version: 3.0.0-beta.6 Node: 12

Locally works ok, but inside a docker container, it cannot build an admin panel.

Dockerfile contents:

FROM node:11.5.0-alpine

COPY . /var/www/cms

WORKDIR /var/www/cms

RUN apk add --no-cache \
  autoconf \
  automake \
  gcc \
  libc-dev \
  libtool \
  make \
  nasm \
  zlib-dev \
  && chmod +x ./strapi.sh

RUN npm install

EXPOSE 1337

CMD ["./strapi.sh"]

strapi.sh contents:

#!/bin/sh
set -ea

_stopStrapi() {
  echo "Stopping strapi"
  kill -SIGINT "$strapiPID"
  wait "$strapiPID"
}

trap _stopStrapi SIGTERM SIGINT

cd /var/www/cms

APP_NAME=${APP_NAME}
DATABASE_HOST=${DATABASE_HOST}
DATABASE_PORT=${DATABASE_PORT}
DATABASE_NAME=${DATABASE_NAME}
DATABASE_USERNAME=${DATABASE_USERNAME}
DATABASE_PASSWORD=${DATABASE_PASSWORD}

NODE_ENV=production npm run build
NODE_ENV=production npm run start &

strapiPID=$!
wait "$strapiPID"

On the step - NODE_ENV=production npm run build - it's failing with following errors:

cms    | Building your admin UI with production configuration ...
cms    | ℹ Compiling Webpack
cms    | (node:17) UnhandledPromiseRejectionWarning: Error: spawn Unknown system error -8
cms    |     at ChildProcess.spawn (internal/child_process.js:372:11)
cms    |     at Object.spawn (child_process.js:543:9)
cms    |     at module.exports (/var/www/cms/node_modules/imagemin-pngquant/node_modules/execa/index.js:204:26)
cms    |     at input (/var/www/cms/node_modules/imagemin-pngquant/index.js:52:13)
dvanblaricom commented 5 years ago

Same issue here, exact same configs, however, i even tried adding in a few alpine packages;

RUN apk update \ && apk add --no-cache \ bash \ build-base \ gcc \ libtool \ autoconf \ automake \ pkgconfig \ nasm \ lcms2-dev \ libpng-dev libjpeg-turbo-dev giflib-dev tiff-dev \ zlib-dev \ && rm -rf /var/cache/apk/*

Seems like alpine will not run pngquant.. see; https://github.com/imagemin/pngquant-bin/issues/65

avxkim commented 5 years ago

@dvanblaricom i switched to node:11.5.0 normal, and build is works through time, seems like some kind of timeout is happening, could you try a default node:11.5.0 image without installing any additional packages?

This react frontend surely requires something else... damn, i hate react, if we had a choice to change it to a Vue.

dvanblaricom commented 5 years ago

Agree with the Vue statement! I am currently attempting the build with node:latest and I still get the same error. i did have it working with ubuntu:bionic and strapi beta 5 with installing gnupg and curl, but when i just went back to using that and strapi beta 7, i am still getting the error. I think it might be strapi beta 7

avxkim commented 5 years ago

Have you tried beta6? I had these issues with 5, 6 beta's for now. Now i just faced this issue:

image

dvanblaricom commented 5 years ago

I have not, it might be node 11 as well as https://github.com/strapi/strapi/issues/3506

avxkim commented 5 years ago

Can you try node:10 image with beta 7? I will try node:10 with beta 6

dvanblaricom commented 5 years ago

yes, trying Node:10 with beta.7 now

dvanblaricom commented 5 years ago

Still an error, slightly different this time;

api_1 | ✔ Webpack: Compiled with some errors in 2.46m api_1 | Error: ./.cache/plugins/strapi-plugin-content-type-builder/admin/src/assets/images/icon_boolean.png api_1 | Module build failed (from ./node_modules/image-webpack-loader/index.js): api_1 | Error: /usr/src/api/strapi-app/node_modules/pngquant-bin/vendor/pngquant: 1: /usr/src/api/strapi-app/node_modules/pngquant-bin/vendor/pngquant: Syntax error: word unexpected (expecting ")") api_1 | api_1 | at makeError (/usr/src/api/strapi-app/node_modules/imagemin-pngquant/node_modules/execa/index.js:172:9) api_1 | at Promise.all.then.arr (/usr/src/api/strapi-app/node_modules/imagemin-pngquant/node_modules/execa/index.js:277:16) api_1 | at process._tickCallback (internal/process/next_tick.js:68:7) api_1 | at compiler.run (/usr/src/api/strapi-app/node_modules/strapi-admin/index.js:140:23) api_1 | at finalCallback (/usr/src/api/strapi-app/node_modules/webpack/lib/Compiler.js:220:39) api_1 | at hooks.done.callAsync.err (/usr/src/api/strapi-app/node_modules/webpack/lib/Compiler.js:236:13) api_1 | at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/src/api/strapi-app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1) api_1 | at AsyncSeriesHook.lazyCompileHook (/usr/src/api/strapi-app/node_modules/tapable/lib/Hook.js:154:20) api_1 | at onCompiled (/usr/src/api/strapi-app/node_modules/webpack/lib/Compiler.js:234:21) api_1 | at hooks.afterCompile.callAsync.err (/usr/src/api/strapi-app/node_modules/webpack/lib/Compiler.js:631:15) api_1 | at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/src/api/strapi-app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1) api_1 | at AsyncSeriesHook.lazyCompileHook (/usr/src/api/strapi-app/node_modules/tapable/lib/Hook.js:154:20) api_1 | at compilation.seal.err (/usr/src/api/strapi-app/node_modules/webpack/lib/Compiler.js:628:31) api_1 | at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/src/api/strapi-app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1) api_1 | at AsyncSeriesHook.lazyCompileHook (/usr/src/api/strapi-app/node_modules/tapable/lib/Hook.js:154:20) api_1 | at hooks.optimizeAssets.callAsync.err (/usr/src/api/strapi-app/node_modules/webpack/lib/Compilation.js:1325:35) api_1 | at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/src/api/strapi-app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1) api_1 | at AsyncSeriesHook.lazyCompileHook (/usr/src/api/strapi-app/node_modules/tapable/lib/Hook.js:154:20) api_1 | at hooks.optimizeChunkAssets.callAsync.err (/usr/src/api/strapi-app/node_modules/webpack/lib/Compilation.js:1316:32) api_1 | npm ERR! code ELIFECYCLE api_1 | npm ERR! errno 1 api_1 | npm ERR! strapi-app@0.1.0 build:strapi build api_1 | npm ERR! Exit status 1 api_1 | npm ERR! api_1 | npm ERR! Failed at the strapi-app@0.1.0 build script. api_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

avxkim commented 5 years ago

I'm building mine, meanwhile, how many cores/ram you allocated for docker?

avxkim commented 5 years ago

image

It's kinda working, i'll try to remove container and build up again, to exclude randomness.

dvanblaricom commented 5 years ago

2 cores, 2GB memory and 1GB swap currently on my local machine

avxkim commented 5 years ago

Have you tried to clean npm caches? The link you provided, a guy mentioned this.

avxkim commented 5 years ago

There's my docker settings:

image

dvanblaricom commented 5 years ago

trying with beta.7, node:10 and added RUN npm cache clean --force RUN npm cache verify RUN npm install

same error as above..

avxkim commented 5 years ago

Just found: https://github.com/strapi/strapi/issues/3383, it's related to ram i guess. Node-sass eats too much ram. I just got the same npm ERR! Exit status 137, sometimes it builds, sometimes - not. Going to try to increase RAM. Node version doesn't matter actually.

rjain15 commented 5 years ago

I am running into getting strapi-docker started. I have added two providers in the strapi.sh

cd $APP_NAME
npm i -S strapi-provider-upload-google-cloud-storage
npm i -S strapi-provider-upload-aws-s3
strapi dev &

And when I start docker-compose up, I get lodash not found, and I believe this is still something to do with not able to install the modules. I have bumped up the docker daemon memory 3 GB, CPU - 4s, SWAP 1 GB

❯ docker-compose up
Creating network "strapi-docker_default" with the default driver
Creating strapi-docker_db_1 ... done
Creating strapi-docker_api_1 ... done
Attaching to strapi-docker_db_1, strapi-docker_api_1
db_1   | 2019-07-02T03:01:20.129+0000 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=60c92a1e8a07
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten] db version v4.0.10
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten] allocator: tcmalloc
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten] modules: none
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten] build environment:
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten]     distarch: x86_64
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten]     target_arch: x86_64
db_1   | 2019-07-02T03:01:20.146+0000 I CONTROL  [initandlisten] options: { net: { bindIpAll: true } }
db_1   | 2019-07-02T03:01:20.156+0000 I STORAGE  [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
db_1   | 2019-07-02T03:01:20.160+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=989M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
db_1   | 2019-07-02T03:01:32.977+0000 I STORAGE  [initandlisten] WiredTiger message [1562036492:977804][1:0x7fee07f14a80], txn-recover: Main recovery loop: starting at 20/11392 to 21/256
db_1   | 2019-07-02T03:01:33.509+0000 I STORAGE  [initandlisten] WiredTiger message [1562036493:509438][1:0x7fee07f14a80], txn-recover: Recovering log 20 through 21
db_1   | 2019-07-02T03:01:33.968+0000 I STORAGE  [initandlisten] WiredTiger message [1562036493:968430][1:0x7fee07f14a80], txn-recover: Recovering log 21 through 21
db_1   | 2019-07-02T03:01:34.036+0000 I STORAGE  [initandlisten] WiredTiger message [1562036494:36173][1:0x7fee07f14a80], txn-recover: Set global recovery timestamp: 0
db_1   | 2019-07-02T03:01:34.057+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
db_1   | 2019-07-02T03:01:34.103+0000 I CONTROL  [initandlisten] 
db_1   | 2019-07-02T03:01:34.103+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
db_1   | 2019-07-02T03:01:34.103+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
db_1   | 2019-07-02T03:01:34.103+0000 I CONTROL  [initandlisten] 
db_1   | 2019-07-02T03:01:34.163+0000 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
db_1   | 2019-07-02T03:01:34.166+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
api_1  | npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN eslint-config-airbnb@13.0.0 requires a peer of eslint@^3.9.1 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN eslint-config-airbnb@13.0.0 requires a peer of eslint-plugin-jsx-a11y@^2.2.3 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN eslint-config-airbnb@13.0.0 requires a peer of eslint-plugin-react@^6.6.0 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN eslint-config-airbnb-base@10.0.1 requires a peer of eslint@^3.9.1 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
api_1  | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
api_1  | 
api_1  | + strapi-provider-upload-google-cloud-storage@3.0.0-beta.8
api_1  | removed 1 package, updated 1 package and audited 27989 packages in 29.339s
api_1  | found 10 vulnerabilities (1 low, 6 moderate, 2 high, 1 critical)
api_1  |   run `npm audit fix` to fix them, or `npm audit` for details
api_1  | npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN eslint-config-airbnb@13.0.0 requires a peer of eslint@^3.9.1 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN eslint-config-airbnb@13.0.0 requires a peer of eslint-plugin-jsx-a11y@^2.2.3 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN eslint-config-airbnb@13.0.0 requires a peer of eslint-plugin-react@^6.6.0 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN eslint-config-airbnb-base@10.0.1 requires a peer of eslint@^3.9.1 but none is installed. You must install peer dependencies yourself.
api_1  | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
api_1  | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
api_1  | 
api_1  | + strapi-provider-upload-aws-s3@3.0.0-next.11
api_1  | updated 1 package and audited 27989 packages in 23.838s
api_1  | found 10 vulnerabilities (1 low, 6 moderate, 2 high, 1 critical)
api_1  |   run `npm audit fix` to fix them, or `npm audit` for details
db_1   | 2019-07-02T03:02:30.088+0000 I NETWORK  [listener] connection accepted from 172.18.0.3:39266 #1 (1 connection now open)
db_1   | 2019-07-02T03:02:30.091+0000 I NETWORK  [conn1] received client metadata from 172.18.0.3:39266 conn1: { driver: { name: "nodejs", version: "3.2.7" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.9.125-linuxkit" }, platform: "Node.js v10.16.0, LE, mongodb-core: 3.2.7" }
api_1  | (node:85) UnhandledPromiseRejectionWarning: Error: Cannot find module 'lodash'
api_1  |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
api_1  |     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
api_1  |     at Module.require (internal/modules/cjs/loader.js:690:17)
api_1  |     at require (internal/modules/cjs/helpers.js:25:18)
api_1  |     at Object.<anonymous> (/usr/src/api/strapi-app/node_modules/strapi-provider-email-sendmail/lib/index.js:8:11)
api_1  |     at Module._compile (internal/modules/cjs/loader.js:776:30)
api_1  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
api_1  |     at Module.load (internal/modules/cjs/loader.js:653:32)
api_1  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
api_1  |     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
api_1  |     at Module.require (internal/modules/cjs/loader.js:690:17)
api_1  |     at require (internal/modules/cjs/helpers.js:25:18)
api_1  |     at module.exports (/usr/src/api/strapi-app/node_modules/strapi-plugin-email/config/functions/bootstrap.js:27:48)
api_1  |     at Promise (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:358:11)
api_1  |     at new Promise (<anonymous>)
api_1  |     at execBootstrap (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:346:14)
api_1  |     at Promise.all.Object.values.map.plugin (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:391:9)
api_1  |     at Array.map (<anonymous>)
api_1  |     at Strapi.runBootstrapFunctions (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:390:35)
api_1  |     at Strapi.start (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:125:18)
api_1  |     at process._tickCallback (internal/process/next_tick.js:68:7)
api_1  | (node:85) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
api_1  | (node:85) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
api_1  | (node:85) UnhandledPromiseRejectionWarning: Error: Cannot find module 'lodash'
api_1  |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
api_1  |     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
api_1  |     at Module.require (internal/modules/cjs/loader.js:690:17)
api_1  |     at require (internal/modules/cjs/helpers.js:25:18)
api_1  |     at Object.<anonymous> (/usr/src/api/strapi-app/node_modules/strapi-provider-upload-aws-s3/lib/index.js:10:11)
api_1  |     at Module._compile (internal/modules/cjs/loader.js:776:30)
api_1  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
api_1  |     at Module.load (internal/modules/cjs/loader.js:653:32)
api_1  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
api_1  |     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
api_1  |     at Module.require (internal/modules/cjs/loader.js:690:17)
api_1  |     at require (internal/modules/cjs/helpers.js:25:18)
api_1  |     at module.exports (/usr/src/api/strapi-app/node_modules/strapi-plugin-upload/config/functions/bootstrap.js:27:49)
api_1  |     at Promise (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:358:11)
api_1  |     at new Promise (<anonymous>)
api_1  |     at execBootstrap (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:346:14)
api_1  |     at Promise.all.Object.values.map.plugin (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:391:9)
api_1  |     at Array.map (<anonymous>)
api_1  |     at Strapi.runBootstrapFunctions (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:390:35)
api_1  |     at Strapi.start (/usr/src/api/strapi-app/node_modules/strapi/lib/Strapi.js:125:18)
api_1  |     at process._tickCallback (internal/process/next_tick.js:68:7)
api_1  | (node:85) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
db_1   | 2019-07-02T03:02:30.182+0000 I NETWORK  [listener] connection accepted from 172.18.0.3:39268 #2 (2 connections now open)
db_1   | 2019-07-02T03:02:30.182+0000 I NETWORK  [conn2] received client metadata from 172.18.0.3:39268 conn2: { driver: { name: "nodejs", version: "3.2.7" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.9.125-linuxkit" }, platform: "Node.js v10.16.0, LE, mongodb-core: 3.2.7" }
db_1   | 2019-07-02T03:02:30.185+0000 I NETWORK  [listener] connection accepted from 172.18.0.3:39270 #3 (3 connections now open)
db_1   | 2019-07-02T03:02:30.186+0000 I NETWORK  [conn3] received client metadata from 172.18.0.3:39270 conn3: { driver: { name: "nodejs", version: "3.2.7" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.9.125-linuxkit" }, platform: "Node.js v10.16.0, LE, mongodb-core: 3.2.7" }
api_1  | [2019-07-02T03:02:33.649Z] warn The bootstrap function is taking unusually long to execute (3500 miliseconds).
api_1  | [2019-07-02T03:02:33.650Z] warn Make sure you call it?
api_1  | [2019-07-02T03:02:33.656Z] warn The bootstrap function is taking unusually long to execute (3500 miliseconds).
api_1  | [2019-07-02T03:02:33.656Z] warn Make sure you call it?
rjain15 commented 5 years ago

On GKE (Kubernetes) when I run the same docker image, I get the error message Error loading the local develop command. Strapi might not be installed in your "node_modules". You may need to run "npm install"

rjain15 commented 5 years ago

I changed the strapi-sh to the following and now I am able to run it in docker/kubernetes.

#!/bin/sh
set -ea

_stopStrapi() {
  echo "Stopping strapi"
  kill -SIGINT "$strapiPID"
  wait "$strapiPID"
}

trap _stopStrapi SIGTERM SIGINT

cd /usr/src/api

APP_NAME=${APP_NAME:-strapi-app}
DATABASE_CLIENT=${DATABASE_CLIENT:-mongo}
DATABASE_HOST=${DATABASE_HOST:-localhost}
DATABASE_PORT=${DATABASE_PORT:-27017}
DATABASE_NAME=${DATABASE_NAME:-strapi}
DATABASE_SRV=${DATABASE_SRV:-false}
EXTRA_ARGS=${EXTRA_ARGS:-}

if [ ! -f "$APP_NAME/package.json" ]
then
    strapi new ${APP_NAME} --dbclient=$DATABASE_CLIENT --dbhost=$DATABASE_HOST --dbport=$DATABASE_PORT --dbsrv=$DATABASE_SRV --dbname=$DATABASE_NAME --dbusername=$DATABASE_USERNAME --dbpassword=$DATABASE_PASSWORD --dbssl=$DATABASE_SSL --dbauth=$DATABASE_AUTHENTICATION_DATABASE $EXTRA_ARGS
    cd $APP_NAME
    npm i -S lodash
    npm i -S strapi-provider-upload-google-cloud-storage
    npm i -S strapi-provider-upload-aws-s3
    npm run setup 
    cd ..
fi

cd $APP_NAME
NODE_ENV=production npm start

strapiPID=$!
wait "$strapiPID"
mastix commented 5 years ago

Can someone summarize what the current issue was/is so that the admin panel can not be built? In general I assume it's still an issue with the current beta (beta.11), right?

I've tried several configurations and now I'm down to beta.7, with node-10 and I had to delete my application to have it created with the aforementioned beta. THIS WORKS.

Does anyone have an idea why this issue is occuring?

Greetz,

Sascha

rjain15 commented 5 years ago

Ok, I tried to add few plugins and recreate the admin panel if I run strapi dev. It works when you are running production. Not sure if you have tried using dev or production?

gregorskii commented 5 years ago

This would be a lot simpler if it wasn't using image minification for production, or didn't use alpine.

I swapped to node-slim and it worked fine. I had to copy over the healthcheck and strapi.sh to my project, and setup the Dockerfile myself.

alexandrebodin commented 4 years ago

HI,

We just released a full rebuild of our docker image 🎉 We are closing the issues and open PRs to start fresh.

If you feel like something is missing or want to add things feel free to open new PRs ! 💯

avxkim commented 4 years ago

@alexandrebodin please, share a link?

alexandrebodin commented 4 years ago

Just read the updated readme ;)

boxedcode commented 4 years ago

I just had this issue running strapi/strapi:latest with docker-compose, following this guideline, but using mysql instead of Mongo DB: https://strapi.io/blog/how-to-run-a-strapi-dev-stack-with-docker-compose

Error loading the local develop command. Strapi might not be installed in your "node_modules". You may need to run "npm install"

The container won't stay up, so I cannot bash into it and run npm install manually.

idimlab commented 4 years ago

@boxedcode Getting the same error with Mongo DB. Have you solved this issue by any chance?

rogoit commented 4 years ago

Also here

alexandrebodin commented 4 years ago

Hi @idimlab @rogoit @boxedcode I see you are not all using the same DB. Would you mind onpening new issues with your specific errors so we can triage them and help you out :)

rogoit commented 4 years ago

Hi @alexandrebodin ,

how can i help. I just do the installation guide and run in the same isse as the rest here. What can i do now?

See you Roland

alexandrebodin commented 4 years ago

@rogoit You can start by opening a new issue with some informations so we can review it with context of recent changes.

We need to know the OS / version / docker-compose or dockerfile you have created

avks commented 4 years ago

@alexandrebodin I am sorry to say this but it is a lame strategy to close an unsolved issue just because there's a rebuild of the images. It seems like people are still having the same issues that was first reported a year back. So, it is evident that "rebuilding" images didn't fix anything.

avks commented 4 years ago

For anyone else having the same issue, here's a dirty fix:

  1. Start the container. This will create the necessary files for a new project.
  2. Stop the container.
  3. cd into the project directory (from host machine).
  4. npm install, assuming almost all distros come with npm preinstalled.
  5. Start the container.
claudiolcastro commented 4 years ago

For anyone else having the same issue, here's a dirty fix:

  1. Start the container. This will create the necessary files for a new project.
  2. Stop the container.
  3. cd into the project directory (from host machine).
  4. npm install, assuming almost all distros come with npm preinstalled.
  5. Start the container.

I'm having the same issue (on MacOS), and I will try this here.. Screen Shot 2020-07-26 at 23 43 31

but.. it was expected that we would have to install the node dependencies even working with Docker... ??

rogoit commented 4 years ago

I am working on Linux Ubuntu ;)

alexandrebodin commented 4 years ago

I just released a new version of the image that fixing an error with the node_modules not being installed if the project doesn't have a package-lock or yarn.lock file. can you test this @rogoit ?

RileyMShea commented 4 years ago

@alexandrebodin I just got a build that failed for the first time with issue

edit Nevermind, I think it was a matter of me trying to use /srv/app for my custom image but it looks like it conflicts with the Base image.

[3/5] Fetching packages...
warning url-loader@1.1.2: Invalid bin field for "url-loader".
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "strapi-admin > bootstrap@4.5.0" has unmet peer dependency "jquery@1.9.1 - 3".
warning "strapi-admin > bootstrap@4.5.0" has unmet peer dependency "popper.js@^1.16.0".
warning "strapi-plugin-graphql > graphql-playground-middleware-koa@1.6.13" has unmet peer dependency "koa@^2".
warning "strapi-plugin-graphql > graphql-type-long@0.1.1" has incorrect peer dependency "graphql@^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0".
warning "strapi-plugin-users-permissions > grant-koa@5.1.1" has unmet peer dependency "koa@>=2.0.0".
[5/5] Building fresh packages...
Done in 49.77s.
Removing intermediate container c09f4541deb0
 ---> 93bbb505f85f
Step 7/10 : COPY . .
 ---> 94d02a7cbc97
Step 8/10 : RUN yarn build --clean
 ---> Running in 106569bbbdd1
yarn run v1.22.4
$ strapi build --clean
Error loading the local build command. Strapi might not be installed in your "node_modules". You may need to run "npm install"
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn build --clean' returned a non-zero code: 1
##[error]Process completed with exit code 1.
FROM strapi/strapi:3.1.1-node12

WORKDIR /srv/app

COPY ./package.json ./
COPY ./yarn.lock ./

ENV NODE_ENV staging

RUN yarn install --prod

COPY . .

RUN yarn build --clean

EXPOSE 1337

CMD ["yarn", "start"]
claudiolcastro commented 4 years ago

I just released a new version of the image that fixing an error with the node_modules not being installed if the project doesn't have a package-lock or yarn.lock file. can you test this @rogoit ?

It worked for me. thanks ;)

ikewabo commented 4 years ago

For anyone else having the same issue, here's a dirty fix:

  1. Start the container. This will create the necessary files for a new project.
  2. Stop the container.
  3. cd into the project directory (from host machine).
  4. npm install, assuming almost all distros come with npm preinstalled.
  5. Start the container.

I'm having the same issue (on MacOS), and I will try this here.. Screen Shot 2020-07-26 at 23 43 31

but.. it was expected that we would have to install the node dependencies even working with Docker... ??

I have a combo of Azure Web App and mounted Azure Storage volume. I have SSHed to the container but can't find the project directory to run npm install. I can see the repo already created on the fileshare. My Potsgres db is a hosted service.

version: '3.3' services: api: image: strapi/strapi init: true restart: always environment:

Note: "StrapiMount" = ${WEBAPP_STORAGE_HOME} ... docker won't accept ${WEBAPP_STORAGE_HOME}. Though StrapiMount was defined with a Path, Strapi dumped the app on the root folder.

Can you please point me to how to reach the project directory? THANK YOU.

c3s4 commented 3 years ago

@alexandrebodin I just got a build that failed for the first time with issue

edit Nevermind, I think it was a matter of me trying to use /srv/app for my custom image but it looks like it conflicts with the Base image.

[3/5] Fetching packages...
warning url-loader@1.1.2: Invalid bin field for "url-loader".
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "strapi-admin > bootstrap@4.5.0" has unmet peer dependency "jquery@1.9.1 - 3".
warning "strapi-admin > bootstrap@4.5.0" has unmet peer dependency "popper.js@^1.16.0".
warning "strapi-plugin-graphql > graphql-playground-middleware-koa@1.6.13" has unmet peer dependency "koa@^2".
warning "strapi-plugin-graphql > graphql-type-long@0.1.1" has incorrect peer dependency "graphql@^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0".
warning "strapi-plugin-users-permissions > grant-koa@5.1.1" has unmet peer dependency "koa@>=2.0.0".
[5/5] Building fresh packages...
Done in 49.77s.
Removing intermediate container c09f4541deb0
 ---> 93bbb505f85f
Step 7/10 : COPY . .
 ---> 94d02a7cbc97
Step 8/10 : RUN yarn build --clean
 ---> Running in 106569bbbdd1
yarn run v1.22.4
$ strapi build --clean
Error loading the local build command. Strapi might not be installed in your "node_modules". You may need to run "npm install"
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn build --clean' returned a non-zero code: 1
##[error]Process completed with exit code 1.
FROM strapi/strapi:3.1.1-node12

WORKDIR /srv/app

COPY ./package.json ./
COPY ./yarn.lock ./

ENV NODE_ENV staging

RUN yarn install --prod

COPY . .

RUN yarn build --clean

EXPOSE 1337

CMD ["yarn", "start"]

Same issue for me, but if I start FROM node:14-alpine the node_modules directory is right there, where is supposed to be. 🤔