nx-extend: Can't Build Strapi From Project Root
If I try to build the strapi app from the project root it crashes. If I cd into the strapi app and run the build it works.
When I build from the project root it runs the executor "@nx-extend/strapi:build", in the project.json, but when I run the build from within the app, it runs strapi build in the package.json.
Node: 16 LTS NPM: 18.19.2 Yarn: 1.22.19 strapi: 4.3.9 nx-extend/strapi version 3.1.2
The error I get when I build from the project root is:
ModuleNotFoundError: Module not found: Error: Can't resolve '@strapi/icons/CarretDown' in '/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/dist/Select'
Did you mean 'CarretDown.js'?
BREAKING CHANGE: The request '@strapi/icons/CarretDown' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/Compilation.js:2016:28
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:798:13
at eval (eval at create (/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:270:22
at eval (eval at create (/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:434:22
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:116:11
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:670:25
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:855:8
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:975:5
resolve '@strapi/icons/CarretDown' in '/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/dist/Select'
Parsed request is a module
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/package.json (relative path: ./dist/Select)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/dist/Select/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/dist/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/node_modules doesn't exist or is not a directory
looking for modules in /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules
existing directory /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/icons
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/icons/package.json (relative path: .)
using exports field: ./dist/CarretDown
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/icons/package.json (relative path: ./dist/CarretDown)
Field 'browser' doesn't contain a valid alias configuration
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/icons/dist/CarretDown doesn't exist
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/node_modules doesn't exist or is not a directory
looking for modules in /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules
existing directory /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/icons
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/icons/package.json (relative path: .)
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/icons/package.json (relative path: ./CarretDown)
Field 'browser' doesn't contain a valid alias configuration
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/icons/CarretDown doesn't exist
/home/ngaritagoitia/Documentos/Playground/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/node_modules doesn't exist or is not a directory
/home/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/admin/node_modules
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/admin/node_modules/@strapi/icons doesn't exist
ModuleNotFoundError: Module not found: Error: Can't resolve '@strapi/icons/CarretDown' in '/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/dist/Select'
Did you mean 'CarretDown.js'?
BREAKING CHANGE: The request '@strapi/icons/CarretDown' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/Compilation.js:2016:28
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:798:13
at eval (eval at create (/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:270:22
at eval (eval at create (/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:434:22
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:116:11
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:670:25
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:855:8
at /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/webpack/lib/NormalModuleFactory.js:975:5
resolve '@strapi/icons/CarretDown' in '/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/dist/Select'
Parsed request is a module
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/package.json (relative path: ./dist/Select)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/dist/Select/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/dist/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/design-system/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/node_modules doesn't exist or is not a directory
looking for modules in /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules
existing directory /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/icons
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/icons/package.json (relative path: .)
using exports field: ./dist/CarretDown
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/icons/package.json (relative path: ./dist/CarretDown)
Field 'browser' doesn't contain a valid alias configuration
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/cms/node_modules/@strapi/icons/dist/CarretDown doesn't exist
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/apps/node_modules doesn't exist or is not a directory
looking for modules in /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules
existing directory /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/icons
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/icons/package.json (relative path: .)
using description file: /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/icons/package.json (relative path: ./CarretDown)
Field 'browser' doesn't contain a valid alias configuration
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/icons/CarretDown doesn't exist
/home/ngaritagoitia/Documentos/Playground/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/Documentos/node_modules doesn't exist or is not a directory
/home/ngaritagoitia/node_modules doesn't exist or is not a directory
/home/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/admin/node_modules
/home/ngaritagoitia/Documentos/Playground/nombre-repositorio/node_modules/@strapi/admin/node_modules/@strapi/icons doesn't exist
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (9 by maintainers)
Going to close this issue now as we now know what caused this.
@Chudroy I think I figured out why it did not work with the newest version: the version of
@strapi/strapithat was is used inside@nx-extend/strapishould be the same (or similar minor version) as the one you use in your own project.I just released
@nx-extend/strapi@3.2.0-alpha.1which is updated to the latest@strapi/strapiand my build (and server) are both working as expected, thing to note is to remove all caches (dist folder and.cachefolder inside the strapi app)My Strapi APP’s package json now has these deps:
@fs-innonova
workspacesis something of yarn. Could you try this@Chudroy thanks for the steps, If I change the
apps/cms/package.jsondeps to the following the build works:I think there may be a issue with the newer Strapi, think this error was also one of the reasons why I did not update it yet in my project.
Will have to dig deeper to see why it fails with the newest verison.