1024pix / pix

Service public d'évaluation et de certification des compétences numériques pour tous.
https://pix.fr
GNU Affero General Public License v3.0
228 stars 52 forks source link

Impossible d'installer l'environnement local - "Error: Cannot find module './build/Debug/addon'" #2076

Closed pixeline closed 3 years ago

pixeline commented 3 years ago

J'essaye d'installer une version locale de pix.fr mais je bloque à cette étape: npm run configure avec ce message:

Error: Cannot find module './build/Debug/addon'

Le log est kilométrique mais voici la partie concernée :


> pix-api@2.213.0 test:api:path /Users/aplennevaux/GITHUB/becode-projects/pix/api
> cross-env NODE_ENV=test mocha --exit --recursive --reporter=dot "tests/integration"

Error: Cannot find module './build/Debug/addon'
Require stack:
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/heapdump/index.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/lib/application/system/system-controller.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/lib/application/system/index.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/lib/routes.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/server.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/tests/integration/application/error-manager_test.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/lib/esm-utils.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/lib/mocha.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/lib/cli/one-and-dones.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/lib/cli/options.js
- /Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/bin/mocha
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/heapdump/index.js:19:15)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/aplennevaux/GITHUB/becode-projects/pix/api/lib/application/system/system-controller.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/aplennevaux/GITHUB/becode-projects/pix/api/lib/application/system/index.js:1:26)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/aplennevaux/GITHUB/becode-projects/pix/api/lib/routes.js:32:3)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/aplennevaux/GITHUB/becode-projects/pix/api/server.js:9:16)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/aplennevaux/GITHUB/becode-projects/pix/api/tests/integration/application/error-manager_test.js:1:22)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.exports.requireOrImport (/Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/lib/esm-utils.js:20:12)
    at Object.exports.loadFilesAsync (/Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/lib/esm-utils.js:33:34)
    at async singleRun (/Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/lib/cli/run-helpers.js:156:3)
    at async Object.exports.handler (/Users/aplennevaux/GITHUB/becode-projects/pix/api/node_modules/mocha/lib/cli/run.js:366:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pix-api@2.213.0 test:api:path: `cross-env NODE_ENV=test mocha --exit --recursive --reporter=dot "tests/integration"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pix-api@2.213.0 test:api:path script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aplennevaux/.npm/_logs/2020-10-28T17_49_11_964Z-debug.log

> pix-api@2.213.0 test:api:path /Users/aplennevaux/GITHUB/becode-projects/pix/api
> cross-env NODE_ENV=test mocha --exit --recursive --reporter=dot "tests/tooling"
octo-topi commented 3 years ago

Salut Alexandre ! Merci d'avoir ouvert cette issue, ça permet de tester si l'installation se passe bien. Nous avons testé l'installation sur Linux, MacOSX et Windows. Pourrais-tu me dire quelle est la configuration ? Ex pour linux uname -a && node --version

Si c'est un Linux, je peux recloner un repo pour voir.

octo-topi commented 3 years ago

ca ressemble pas mal à ça ! https://github.com/bnoordhuis/node-heapdump/issues/150

octo-topi commented 3 years ago

Ceci dit, je vois que tu utilises la version avec cross-env qui a été supprimée, voir https://github.com/1024pix/pix/pull/2056 Pourrais-tu pull sur dev + réessayer ?

pixeline commented 3 years ago

Salut Alexandre ! Merci d'avoir ouvert cette issue, ça permet de tester si l'installation se passe bien. Nous avons testé l'installation sur Linux, MacOSX et Windows. Pourrais-tu me dire quelle est la configuration ? Ex pour linux uname -a && node --version

Si c'est un Linux, je peux recloner un repo pour voir.

Bonjour! Ma config: Mac OS X 10.15.7 node: 12.19 npm: 6.14.8

Je teste la version sur dev. Là je cale encore mais sur des dépendances manquantes. Je mets à jour ce thread si besoin.

pixeline commented 3 years ago

OK, je cale encore, voici l'extrait du log:

Starting infrastructure building blocks…
Traceback (most recent call last):
  File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
  File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1252, in request
  File "http/client.py", line 1298, in _send_request
  File "http/client.py", line 1247, in endheaders
  File "http/client.py", line 1026, in _send_output
  File "http/client.py", line 966, in send
  File "site-packages/docker/transport/unixconn.py", line 43, in connect
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages/requests/adapters.py", line 449, in send
  File "site-packages/urllib3/connectionpool.py", line 727, in urlopen
  File "site-packages/urllib3/util/retry.py", line 403, in increment
  File "site-packages/urllib3/packages/six.py", line 734, in reraise
  File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
  File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1252, in request
  File "http/client.py", line 1298, in _send_request
  File "http/client.py", line 1247, in endheaders
  File "http/client.py", line 1026, in _send_output
  File "http/client.py", line 966, in send
  File "site-packages/docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages/docker/api/client.py", line 205, in _retrieve_server_version
  File "site-packages/docker/api/daemon.py", line 181, in version
  File "site-packages/docker/utils/decorators.py", line 46, in inner
  File "site-packages/docker/api/client.py", line 228, in _get
  File "site-packages/requests/sessions.py", line 543, in get
  File "site-packages/requests/sessions.py", line 530, in request
  File "site-packages/requests/sessions.py", line 643, in send
  File "site-packages/requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 67, in main
  File "compose/cli/main.py", line 123, in perform_command
  File "compose/cli/command.py", line 69, in project_from_options
  File "compose/cli/command.py", line 132, in get_project
  File "compose/cli/docker_client.py", line 43, in get_client
  File "compose/cli/docker_client.py", line 170, in docker_client
  File "site-packages/docker/api/client.py", line 188, in __init__
  File "site-packages/docker/api/client.py", line 213, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
[26770] Failed to execute script docker-compose
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! pix@2.217.0 configure: `./scripts/configure.sh`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the pix@2.217.0 configure script.
pixeline commented 3 years ago

Oh, it was too obvious for me to see it : the Docker Daemon was idle... 🙄

pixeline commented 3 years ago

I'm getting closer I guess, but I now encounter this error, related to Ember. I looked around in Google but haven't found a way to solve it (tried deleting node_modules folder then restart, no avail) :

Working directory changed to ~/GITHUB/becode-projects/pix/api/db
Using environment: development
FS-related option specified for migration configuration. This resets migrationSource to default FsMigrations
FS-related option specified for migration configuration. This resets migrationSource to default FsMigrations
Already up to date
✅ PostgreSQL and Redis servers started (using Docker Compose).

Executing Pix apps tests…

> pix-admin@2.217.0 test /Users/aplennevaux/GITHUB/becode-projects/pix/admin
> ember test --reporter dot

Environment: test
cleaning up...
Build Error (broccoli-persistent-filter:Babel > [Babel: @ember-data/store]) in -private/system/references/reference.ts

/Users/aplennevaux/GITHUB/becode-projects/pix/admin/-private/system/references/reference.ts: Imported DEPRECATE_REFERENCE_INTERNAL_MODEL from @ember-data/private-build-infra/deprecations which is not a supported flag.

Stack Trace and Error Report: /var/folders/57/27twnfps5_zbsg_77nsbtqg00000gp/T/error.dump.7153df2e7d987dda44cc663031e585d3.log
HEYGUL commented 3 years ago

I had same error not so long ago (after our latest ember upgrade PR has been merged). I fixed it by running a fresh npm install instead of the usual npm ci.

Hope this helps.

BTW, I am curious to know what is your purpose cloning and running Pix ? May we see PR from you soon 😎 ?

pixeline commented 3 years ago

I had same error not so long ago (after our latest ember upgrade PR has been merged). I fixed it by running a fresh npm install instead of the usual npm ci.

Hope this helps.

BTW, I am curious to know what is your purpose cloning and running Pix ? May we see PR from you soon 😎 ?

ok will try that! To answer your question, I work in a non-profit organization in Belgium (BeCode). We provide inclusive coding bootcamps for people far away from employment (refugees, school dropouts, long-time unemployed) with the goal that they start a successful career in IT. We need a tool to certify the DigComp (fundamental digital skills, EU standard) and I loved the UX provided by pix.fr. I would like to dig deeper in the project to see if we could spin a Belgium version, allowing for a multilingual approach (English and Dutch alongside French). If we can we will definitely provide PRs !! I do need to have a running devel environment first to see how feasible this multilingual port could be.

pixeline commented 3 years ago

still stuck - deleting node_modules, npm ci or npm install, none of these solve the issue. I'm a bit at loss here, would you have any idea ? (I'm using the devbranch version)

octo-topi commented 3 years ago

Let's go on in english if you prefer.

Can you attach you /api/.env file for diagnostic too ?

Your original error message was related to heapdump https://github.com/1024pix/pix/issues/2076#issuecomment-722423463

And I see you use node 12.19

So I suggest you to checkout this PR as it

We can then check if it's a version-related issue.

pixeline commented 3 years ago

Hello! Sorry, I keep moving from FR to EN during my day job so je me perds parfois dans la traduction :-) (en Belgique on appelle cela le syndrome Jean-Claude Van Damme :-)) ) Je vais tester le PR, merci!

Voici le fichier .env

# This file is the minimal confuguration file used by Dotenv to define the
# environment variables on localhost.
#
# Instructions:
#   1. copy this file as `.env`
#   2. edit the `.env` file with working values
#   3. uncomment the lines to activate or configure associated features
#
# Sections (displayed in sorted in alphabtic order):
#   - caching
#   - databases
#   - emailing
#   - learning content
#   - logging
#   - security
#
# Line size max: 80 characters.
#

# =======
# CACHING
# =======

# URL of the Redis server used for caching learning content from Airtable.
#
# If not present, only the in-memory cache will be active and the learning
# content will be re-fetched from Airtable at each restart of the API.
#
# presence: optionnal
# type: Url
# default: none
REDIS_URL=redis://localhost:6379

# =========
# DATABASES
# =========

# URL of the PostgreSQL databse used for storing users data (filled-in or
# generated).
#
# If not present, the application will crash during API boostrap.
#
# presence: required
# type: Url
# default: none
DATABASE_URL=postgresql://postgres@localhost/pix

# URL of the PostgreSQL databse used for API local testing.
#
# If not present, the tests will fail.
#
# presence: required
# type: Url
# default: none
TEST_DATABASE_URL=postgresql://postgres@localhost/pix_test

# ========
# EMAILING
# ========

# Enable or disable the sending of e-mails.
#
# presence: optionnal
# type: Boolean
# default: `false`
# MAILING_ENABLED=true

# Select the emailing service provider. Availaible providers supported  are
# Sendinblue (value="sendinblue") or MailJet (value="mailjet").
#
# presence: required only if emailing is enabled
# type: String
# default: "mailjet"
# MAILING_PROVIDER=sendinblue

# MailJet
# -------

# "Key" part of the credentials required to call the MailJet API.
#
# presence: required if emailing is enabled and provider is MailJet
# type: String
# default: none
# MAILJET_API_KEY=

# "Secret" part of the credentials required to call the MailJet API.
#
# If not present when required, the e-mail will not be sent errors will be
# thrown.
#
# presence: required only if emailing is enabled and provider is MailJet
# type: String
# default: none
# MAILJET_API_SECRET=

# ID of the template used for generating the e-mail when an account is created.
#
# If not present when required, the e-mail will not be sent and an error will
# be thrown.
#
# presence: required only if emailing is enabled and provider is MailJet
# type: Number
# default: none
# MAILJET_ACCOUNT_CREATION_TEMPLATE_ID=

# ID of the template used for generating the e-mail when a user is invited to
# join an organization.
#
# If not present when required, the e-mail will not be sent and an error will
# be thrown.
#
# presence: required only if emailing is enabled and provider is MailJet
# type: Number
# default: none
# MAILJET_ORGANIZATION_INVITATION_TEMPLATE_ID=

# ID of the template used for generating the e-mail when a user want to
# generate a new password.
#
# If not present when required, the e-mail will not be sent and an error will
# be thrown.
#
# presence: required only if emailing is enabled and provider is MailJet
# type: Number
# default: none
# MAILJET_PASSWORD_RESET_TEMPLATE_ID=

# Sendinblue
# ----------

## API key required to call the Sendinblue API.
#
# presence: required if emailing is enabled and provider is Sendinblue
# type: String
# default: none
# SENDINBLUE_API_KEY=

# ID of the template used for generating the e-mail when an account is created.
#
# If not present when required, the e-mail will not be sent and an error will
# be thrown.
#
# presence: required only if emailing is enabled and provider is Sendinblue
# type: Number
# default: none
# SENDINBLUE_ACCOUNT_CREATION_TEMPLATE_ID=

# ID of the template used for generating the e-mail when a user is invited to
# join an organization.
#
# If not present when required, the e-mail will not be sent and an error will
# be thrown.
#
# presence: required only if emailing is enabled and provider is Sendinblue
# type: Number
# default: none
# SENDINBLUE_ORGANIZATION_INVITATION_TEMPLATE_ID=

# ID of the template used for generating the e-mail when a user want to
# join a SCO organization.
#
# If not present when required, the e-mail will not be sent and an error will
# be thrown.
#
# presence: required only if emailing is enabled and provider is Sendinblue
# type: Number
# default: none
# SENDINBLUE_ORGANIZATION_INVITATION_SCO_TEMPLATE_ID=

# ID of the template used for generating the e-mail when a user want to
# generate a new password.
#
# If not present when required, the e-mail will not be sent and an error will
# be thrown.
#
# presence: required only if emailing is enabled and provider is Sendinblue
# type: Number
# default: none
# SENDINBLUE_PASSWORD_RESET_TEMPLATE_ID=

# String for links in emails redirect to a specific domain when user comes from french domain
#
# presence: optional
# type: String
# default: '.fr'
# TLD_FR=

# String for links in emails redirect to a specific domain when user comes from international domain
#
# presence: optional
# type: String
# default: '.org'
# TLD_ORG=

# String for links in emails to build url with Pix domain
#
# presence: optional
# type: String
# default: 'pix'
# DOMAIN_PIX=

# String for links in emails to build url with Pix App domain
#
# presence: optional
# type: String
# default: 'app.pix'
# DOMAIN_PIX_APP=

# String for links in emails to build url with Pix Orga domain
#
# presence: optional
# type: String
# default: 'orga.pix'
# DOMAIN_PIX_ORGA=

# ================
# LEARNING CONTENT
# ================

# API key provided by learning content management system.
#
# If not present and if the Redis cache were not enabled/preloaded, the
# application will crash during data fetching.
#
# presence: required
# type: String
# default: none
LCMS_API_KEY=e5d7b101-d0bd-4a3b-86c9-61edd5d39e8d

# Learning content API URL.
#
# If not present and if the Redis cache were not enabled/preloaded, the
# application will crash during data fetching.
#
# presence: required
# type: String
# default: none
LCMS_API_URL=https://lcms.minimal.pix.fr/api/airtable

# =======
# LOGGING
# =======

# Enable or disable the logging of the API.
#
# presence: optionnal
# type: Boolean
# default: `false`
LOG_ENABLED=true

# Enable or disable the logging of the API.
#
# presence: optionnal
# type: String
# default: "info"
# LOG_LEVEL=debug

# ========
# SECURITY
# ========

# Secret salt value used in JWT token generation.
#
# If not present, the application will crash during bootstrap.
#
# presence: required
# type: String
# default: none
AUTH_SECRET=Change me!
octo-topi commented 3 years ago

Merci pour le .env (qui a l'air OK) La PR a été mergée, tu peux essayer sur dev

octo-topi commented 3 years ago

Hello. Penses-tu essayer à nouveau ? Si ce n'est pas le cas, je propose de fermer, l'issue, quitte à la rouvrir ensuite

pixeline commented 3 years ago

Switcher sur dev n'a pas résolu l'issue, message identique. Je ferme donc l' issue pour l'instant. Merci pour votre temps !