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

When running node build --all It fails (Error: Command failed: npm ci.) #14

Closed
rabiibrahimi opened this issue Mar 3, 2023 · 16 comments
Closed

Comments

@rabiibrahimi
Copy link

rabiibrahimi commented Mar 3, 2023

Screenshot 2023-03-03 at 13 13 32

I can't run node build --all it always failed Error: Command failed: npm ci.

I am using macbook pro M1. any idea whyl npm ci fails.

node version: v19.6.1
npm version: 9.5.0

@rabiibrahimi rabiibrahimi changed the title When running node build --all It failed When running node build --all It fails (Error: Command failed: npm ci.) Mar 3, 2023
@yurikuzn
Copy link
Collaborator

yurikuzn commented Mar 3, 2023

Can you help to find out. I'm dealing with a few dozens issues daily, it's really hard for me.

@yurikuzn
Copy link
Collaborator

yurikuzn commented Mar 3, 2023

I tried on my environment and it worked w/o errors.

@rabiibrahimi
Copy link
Author

It is weird i think this is an issue with silicon M1 chips, cause i can see that the script doesn't get passed npm ci (cp.execSync("npm ci", {cwd: './site', stdio: 'ignore'});) it stops here. i will keep looking to see if i can manage to fix this on my environment.
Thanks

@czcpf
Copy link

czcpf commented Apr 19, 2023

@rabiibrahimi I have a similar issue. What is the fix here?
node v20.0.0
npm v9.6.4
2023-04-19T19_45_58_125Z-debug-0.log

@czcpf
Copy link

czcpf commented Apr 19, 2023

I made some progress here.

from
cp.execSync("npm ci", {cwd: './site', stdio: 'ignore'});
to
cp.execSync("npm ci", {pwd: './site', stdio: 'ignore'});

This gets me past the npm stage but now i'm getting an error on the next line

cp.execSync("grunt", {cwd: './site', stdio: 'ignore'});

I tried
cp.execSync("grunt", {pwd: './site', stdio: 'ignore'});

but that doesn't work. I see that Gruntfile.js in /site has a bunch of cwd references as well. Is this some issue on intel mac understanding cwd ?

UPDATE

It looks like this won't build at all with node v20.* on my intel mac only node v16.* seems to be working with this.

So here is how I got this to work for anyone who wants to save hours and hours...

brew remove node
brew install node@16
brew link --overwrite node@16

@rabiibrahimi
Copy link
Author

i have solved it by downgrade node and npm so currently i use these versions:
node v16.19.1
npm 8.19.3

and it works now. guess it is issue with version compatibility.

@czcpf
Copy link

czcpf commented Apr 20, 2023 via email

@bandtank
Copy link
Contributor

bandtank commented May 24, 2023

M1/M2 macs don't work with version 16, so there is no way to fix the issue because version 14 is incompatible. The issue with 16 is as follows:

npm ERR! npm ERR! The chromium binary is not available for arm64:

I have not found a solution yet.

@rabiibrahimi
Copy link
Author

it does i am on M1 Pro and using node v16.19.1 and npm v8.19.3 and it works fine. just for your info i am using laravel valet for dev env.

@bandtank
Copy link
Contributor

You must have not installed it recently or without needing to install the chromium binary. npm will not resolve the chromium dependency.

@czcpf
Copy link

czcpf commented May 25, 2023 via email

@czcpf
Copy link

czcpf commented May 26, 2023 via email

@rabiibrahimi
Copy link
Author

You must have not installed it recently or without needing to install the chromium binary. npm will not resolve the chromium dependency.

You are right, this was solved couple months for my Mac M1.

@bandtank
Copy link
Contributor

I gave up trying to make this work in OSX with an M1 processor:

/site: node --version
v16.19.1
/site: npm --version
8.19.3
/site: npm ci
...
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /Users/test/.npm/_cacache/tmp/git-clone1o9YKE/node_modules/puppeteer
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c -- node install.js
npm ERR! npm ERR! The chromium binary is not available for arm64: 
npm ERR! npm ERR! If you are on Ubuntu, you can install with: 
npm ERR! npm ERR! 
npm ERR! npm ERR!  apt-get install chromium-browser
npm ERR! npm ERR! 
npm ERR! npm ERR! /Users/test/.npm/_cacache/tmp/git-clone1o9YKE/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:112
npm ERR! npm ERR!             throw new Error();
npm ERR! npm ERR!             ^
npm ERR! npm ERR! 
npm ERR! npm ERR! Error
npm ERR! npm ERR!     at /Users/test/.npm/_cacache/tmp/git-clone1o9YKE/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:112:19
npm ERR! npm ERR!     at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/test/.npm/_logs/2023-05-28T11_23_52_741Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/test/.npm/_logs/2023-05-28T11_23_49_887Z-debug-0.log

Nothing has worked. Now I'm trying in Docker. Using linux/arm64, which is the default platform for my system, didn't work due lack of arm64 support for PhantomJS. Switching to linux/amd64 pushed the process forward, but now grunt is missing.

# node build --all
Fetching EspoCRM repository...
  Downloading EspoCRM archive from Github...
  Unzipping...
Installing EspoCRM instance...
  Creating config...
  Npm install...
  Building...
node:internal/errors:857
  const err = new Error(message);
              ^

Error: Command failed: grunt
    at checkExecSyncError (node:child_process:861:11)
    at Object.execSync (node:child_process:932:15)
    at buildEspo (/app/build.js:188:8)
    at /app/build.js:124:9
    at new Promise (<anonymous>)
    at install (/app/build.js:118:12)
    at /app/build.js:16:17 {
  status: 127,
  signal: null,
  output: [ null, null, null ],
  pid: 361,
  stdout: null,
  stderr: null
}
# pwd
/app
# cd site
# grunt
/bin/sh: 5: grunt: not found

This site says to do the following: npm install -g grunt-cli and then npm install grunt-cli --save-dev in the project's root folder. Note: The repository's instructions do not say to install grunt-cli, but it is a required dependency.

Once that was resolved, the process fails again:

# node build --all
Fetching EspoCRM repository...
  Downloading EspoCRM archive from Github...
  Unzipping...
Installing EspoCRM instance...
  Creating config...
  Npm install...
  Building...
  Install: step1...
  Install: setupConfirmation...
  Install: checkPermission...
  Install: saveSettings...
  Install: buildDatabase...
  Install: createUser...
  Install: finish...
  Merge configs...
node:internal/errors:857
  const err = new Error(message);
              ^

Error: Command failed: php merge_configs.php
    at checkExecSyncError (node:child_process:861:11)
    at Object.execSync (node:child_process:932:15)
    at /app/build.js:175:12
    at new Promise (<anonymous>)
    at install (/app/build.js:118:12)
    at /app/build.js:16:17 {
  status: 255,
  signal: null,
  output: [ null, Buffer(0) [Uint8Array] [], Buffer(0) [Uint8Array] [] ],
  pid: 3472,
  stdout: Buffer(0) [Uint8Array] [],
  stderr: Buffer(0) [Uint8Array] []
}

Running the file directly shows the error:

# php php_scripts/merge_configs.php
PHP Warning:  include(../site/bootstrap.php): Failed to open stream: No such file or directory in /app/php_scripts/merge_configs.php on line 3
PHP Warning:  include(): Failed opening '../site/bootstrap.php' for inclusion (include_path='.:/usr/share/php') in /app/php_scripts/merge_configs.php on line 3
PHP Fatal error:  Uncaught Error: Class "Espo\Core\Application" not found in /app/php_scripts/merge_configs.php:5
Stack trace:
#0 {main}
  thrown in /app/php_scripts/merge_configs.php on line 5

I don't know what to do at this point.

@rabiibrahimi
Copy link
Author

rabiibrahimi commented May 28, 2023

Once that was resolved, the process fails again:

I have had same and it was just database, before running node build --all MAKE SURE YOU HAVE CREATED A DATABASE IN MYSQL.
of course database should match the name of db you set in config.json and also username and password.

@bandtank
Copy link
Contributor

On an M1 mac, you have to do this:

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

Once that has been done, it seems to work. Note: it is important to watch the log files in site/data/logs/. Node's output is useless once Espo has started running. For example, if a database isn't accessible, node fails without saying why, but Espo's log will at least mention sql errors.

Here is my setup:

M1 Max
Ventura 13.3.1(a)

node --version
v16.19.1

npm --version
8.19.3

composer --version
Composer version 2.5.6 2023-05-24 09:14:18

php --version
PHP 8.2.6 (cli) (built: May 10 2023 06:14:09) (NTS)

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

4 participants