Skip to content

[Bug]: baremetal deployment - yarn install fails because of package cpu-features via node-ssh #1307

@Bigood

Description

@Bigood

What's not working?

Hello!

I have this issue when deploying with baremetal, at install step :

warning Error running install script for optional dependency: "/PROJECT/node_modules/cpu-features: Command failed.
Exit code: 1
Command: node buildcheck.js > buildcheck.gypi && node-gyp rebuild
Arguments:
Directory: /PROJECT/node_modules/cpu-features
Output:
/PROJECT/node_modules/buildcheck/lib/index.js:115
  throw new Error('Unable to detect compiler type');
  ^

Error: Unable to detect compiler type
    at BuildEnvironment.getKind (/PROJECT/node_modules/buildcheck/lib/index.js:115:9)
    at BuildEnvironment.tryCompile (/PROJECT/node_modules/buildcheck/lib/index.js:537:15)
    at BuildEnvironment.checkHeader (/PROJECT/node_modules/buildcheck/lib/index.js:423:25)
    at Object.<anonymous> (/PROJECT/node_modules/cpu-features/buildcheck.js:16:4)
    at Module._compile (node:internal/modules/cjs/loader:1761:14)
    at Object..js (node:internal/modules/cjs/loader:1893:10)
    at Module.load (node:internal/modules/cjs/loader:1481:32)
    at Module._load (node:internal/modules/cjs/loader:1300:12)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)

Node.js v24.13.0"

Here's the file : https://github.com/mscdex/buildcheck/blob/master/lib/index.js#L31
I guess it's because I don't have any compiler installed on my production server.

The node-ssh dep is used by the baremetal setup, which is intended to be used locally, and set up in devDependencies : https://github.com/cedarjs/cedar/blame/72dda01dc80b854924ba2a0e7b5471dbb3fe0a94/packages/cli/src/commands/setup/deploy/providers/baremetalHandler.js#L50

IMHO the target server should not need to install this dep, so I tried to tweak the yarn install step to add --prod here :
https://github.com/cedarjs/cedar/blob/72dda01dc80b854924ba2a0e7b5471dbb3fe0a94/packages/cli/src/commands/deploy/baremetal/baremetalHandler.js#361

I then get this :

 Error while running command `yarn cedar build api` in /var/www/alpha.app/20260304153339    
 node:internal/modules/cjs/loader:1424                                                      
 throw err;                                                                                 
 ^                                                                                          
                                                                                            
 Error: Cannot find module '@cedarjs/cli/package.json'                                      
 Require stack:                                                                             
 - /var/www/alpha.app/20260304153339/node_modules/@cedarjs/web/dist/cjs/bins/cedar.js       
 at Module._resolveFilename (node:internal/modules/cjs/loader:1421:15)                      
 at require.resolve (node:internal/modules/helpers:163:19)                                  
 at Object.<anonymous>                                                                      

How can this be handled:

  • Do you think we should we move all production deps to dependencies, and use yarn install --prod?
  • Use yarn-add-no-save ?

As a workaround, I keep the upstream package.json without node-ssh package.

How do we reproduce the bug?

No response

What's your environment? (If it applies)

System:
    OS: Linux 5.10 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 24.13.0 - /tmp/yarn--1772639413112-0.5991317049508759/node
    Yarn: 1.22.19 - /tmp/yarn--1772639413112-0.5991317049508759/yarn
  npmPackages:
    @cedarjs/auth-supabase-setup: 2.6.0 => 2.6.0
    @cedarjs/cli-data-migrate: 2.6.0 => 2.6.0
    @cedarjs/core: 2.6.0 => 2.6.0
  redwood.toml:
    [web]
      title = "PROJECT"
      port = "${REDWOOD_WEB_PORT}"
      apiUrl = "/api" # you can customise graphql and dbauth urls individually too: see https://redwoodjs.com/docs/app-configuration-redwood-toml#api-paths
    [api]
      port = "${REDWOOD_API_PORT}"
      schemaPath = "./api/db/schema" #https://docs.redwoodjs.com/docs/app-configuration-redwood-toml/#multi-file-schema
    [browser]
      open = false
    [notifications]
      versionUpdates = ["latest"]
    [experimental.sentry]
    	enabled = true
    [graphql]
      fragments = true
Done in 1.02s.

Are you interested in working on this?

  • I'm interested in working on this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/needs-infoMore information is needed for reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions