Closed Chudroy closed 1 year ago
In what package.json
is @strapi/icon
located? And what version of the Strapi packages are you using?
Hi,
there is a yarn.lock at the project root and one in the strapi admin app. The versions differ. in both
Could you remove the yarn.lock in the strapi folder and add the following to your package.json in the root
"workspaces": {
"packages": [
"apps/**", // both options can
"apps/cms"
]
},
You should then also be able to remove the packages from the root.
I have followed your instructions. Unfortunately, I am still getting the same error.
I did a yarn install and this appeared, also.
The cms is located at apps/cms
right? That package.json with all the Strapi deps are still there?
Could you share that package.json
Yes, here you go:
{
"name": "cms",
"private": true,
"version": "0.1.0",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"devDependencies": {},
"dependencies": {
"@strapi/strapi": "4.5.2",
"@strapi/plugin-users-permissions": "4.5.2",
"@strapi/plugin-i18n": "4.5.2",
"better-sqlite3": "7.4.6"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "360f24e3-9193-435f-9202-762280632d53"
},
"engines": {
"node": ">=14.19.1 <=18.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}
Could you try by adding "@strapi/design-system": "1.2.8",
?
Or with the following packages?
"@strapi/design-system": "1.2.8",
"@strapi/plugin-i18n": "4.4.5",
"@strapi/plugin-users-permissions": "4.4.5",
"@strapi/strapi": "4.4.5",
Atm i'm unable to reproduce the issue with my own Strapi project so not 100% what is causing this.
This also, unfortunately has not worked. I will create a new nx and strapi project, and write down all the steps to reproduce the issue.
npx create-nx-workspace@latest strapi-workspace --preset=angular --appName=web --style=scss --nxCloud=false --package-manager=yarn
cd strapi-workspace
nvm use 16.18.1
LTS Node 16 version
yarn add @nx-extend/strapi --dev
yarn run nx g @nx-extend/strapi:init cms
in /package.json, in "scripts", change "ng":"nx" to "nx":"nx"
yarn nx build cms
and then I get the error in the original post. Also of note right now is that if I use npm to install deps, I get dependency errors for the angular app also. Just all around dep hell right now.
Just to be sure, you did run nx g @nx-extend/strapi:init
?
oh, yeah, I did. I'll edit that into the previous post, oops
@Chudroy thanks for the steps, If I change the apps/cms/package.json
deps to the following the build works:
"dependencies": {
"@strapi/design-system": "1.2.8",
"@strapi/plugin-i18n": "4.4.5",
"@strapi/plugin-users-permissions": "4.4.5",
"@strapi/strapi": "4.4.5",
"better-sqlite3": "7.4.6"
},
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.
And it worked! Thanks so much. How did you decide which versions to use? If you find out more, please let me know.
Have a good Monday!
Could you remove the yarn.lock in the strapi folder and add the following to your package.json in the root
"workspaces": { "packages": [ "apps/**", // both options can "apps/cms" ] },
You should then also be able to remove the packages from the root.
If I try to do this then when I run npm i
I get this error:
npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "$" of package "$@swc/core": name can only contain URL-friendly characters.
@Chudroy I think I figured out why it did not work with the newest version: the version of @strapi/strapi
that was is used inside @nx-extend/strapi
should 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.1
which is updated to the latest @strapi/strapi
and my build (and server) are both working as expected, thing to note is to remove all caches (dist folder and .cache
folder inside the strapi app)
My Strapi APP's package json now has these deps:
"@strapi/design-system": "1.4.0",
"@strapi/plugin-graphql": "4.5.4",
"@strapi/plugin-i18n": "4.5.4",
"@strapi/plugin-seo": "1.7.7",
"@strapi/plugin-users-permissions": "4.5.4",
"@strapi/provider-email-sendgrid": "4.5.4",
"@strapi/strapi": "4.5.4",
Going to close this issue now as we now know what caused this.
Yep, thanks for the help
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 runsstrapi 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: