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

Document the supported node version in .nvmrc #745

Closed
wants to merge 1 commit into from

Commits on Jul 29, 2024

  1. Document the supported node version in .nvmrc

    I would suggest documenting the expected node version programmatically.
    
    The README states:
    
    > Ensure you have the latest LTS version of Node.js installed
    
    Currently, this [seems](https://nodejs.org/en/about/previous-releases) to be Node.js 20.
    
    However, when I clone this repo, and I [`nvm use`](https://github.com/nvm-sh/nvm) the node version 20.16.0, and I `npm install` and I start the app with `npm run fiori`, then I get the error: 
    
    ```
    ❗️ ERROR on server start: ❗️
    
     Error: The module '/Users/me/git/cloud-cap-samples/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 108. This version of Node.js requires
    NODE_MODULE_VERSION 115. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).
        at Module._extensions..node (node:internal/modules/cjs/loader:1454:18)
        at Module.load (node:internal/modules/cjs/loader:1208:32)
        at Module._load (node:internal/modules/cjs/loader:1024:12)
        at Module.require (node:internal/modules/cjs/loader:1233:19)
        at require (node:internal/modules/helpers:179:18)
        at bindings (/Users/me/git/cloud-cap-samples/node_modules/bindings/bindings.js:112:48)
        at new Database (/Users/me/git/cloud-cap-samples/node_modules/better-sqlite3/lib/database.js:48:64)
        at create (/Users/me/git/cloud-cap-samples/node_modules/@cap-js/sqlite/lib/SQLiteService.js:25:21)
        at Pool._createResource (/Users/me/git/cloud-cap-samples/node_modules/generic-pool/lib/Pool.js:319:42)
        at Pool._dispense (/Users/me/git/cloud-cap-samples/node_modules/generic-pool/lib/Pool.js:237:12)
    Active connections:0
     {
      code: 'ERR_DLOPEN_FAILED'
    }
    ```
    
    I retried with node v18.20.4 and it worked fine. I'd suggest adding a hint about the expected node version as [a `.nvmrc` file](https://github.com/nvm-sh/nvm?tab=readme-ov-file#nvmrc) in the repo.  
    
    Alternatively, the supported node version could be specified in the [engines](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines) section of the package.json file.
    
    ### Version information:
    
    ```
    @cap-js/asyncapi: 1.0.2
    @cap-js/openapi: 1.0.4
    @cap-js/sqlite: 1.7.3
    @capire/samples: 2.1.0
    @sap/cds: 8.0.4
    @sap/cds-compiler: 5.0.6
    @sap/cds-dk: 8.0.3
    @sap/cds-dk (global): 8.0.3
    @sap/cds-fiori: 1.2.7
    @sap/cds-foss: 5.0.1
    @sap/cds-mtxs: 2.0.3
    @sap/eslint-plugin-cds: 3.0.4
    Node.js: v20.16.0
    ```
    PierreFritsch authored Jul 29, 2024
    Configuration menu
    Copy the full SHA
    32c78f2 View commit details
    Browse the repository at this point in the history