codaxy/cxjs

Cannot create a new project with cx-cli

dgeorgievski opened this issue · 4 comments

Hi,

I was following "Get started" instructions to create a new project:

npm install cx-cli --global
cx create my-app
# selected Basic template
cd my-app
npm start

Installed webpack packages after npm start complaining they are missing:

  1. webpack-dev-server
  2. webpack-cli
  3. webpack, which broke with the same error that npm install displays
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cx-app-tpl@1.0.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from cx-react@17.10.0
npm ERR! node_modules/cx-react
npm ERR!   cx-react@"^17.10.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/dimitar/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dimitar/.npm/_logs/2022-11-23T21_06_24_695Z-debug-0.log

I am using:

  1. Cx CLI v21.6.2
  2. node v19.1.0
  3. npm 8.19.3
  4. OS - Ubuntu 22.04 LTS

I have to mention I tried other cx create options and they all failed similarly.

Thanks for reporting this. There is definitely a problem and we're going to fix it.

As a temporary workaround you may install packages this way:

npm install --legacy-peer-deps

or use Yarn.

Yarn produces the same error as nmp install

I tried npm install --legacy-peer-deps.
It fails with a different error. Module node-sass fails compilation. I found from the npm web site this module is deprecated and not supported any longer.

 myapp npm install --legacy-peer-deps
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path /home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c -- node scripts/build.js
npm ERR! Building: /home/dimitar/.nvm/versions/node/v19.1.0/bin/node /home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/home/dimitar/.nvm/versions/node/v19.1.0/bin/node',
npm ERR! gyp verb cli   '/home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@19.1.0 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python checking Python explicitly set from command line or npm configuration
npm ERR! gyp verb find Python - "--python=" or "npm config get python" is "/usr/bin/python3"
npm ERR! gyp verb find Python - executing "/usr/bin/python3" to get executable path
npm ERR! gyp verb find Python - executable path is "/usr/bin/python3"
npm ERR! gyp verb find Python - executing "/usr/bin/python3" to get version
npm ERR! gyp verb find Python - version is "3.10.6"
npm ERR! gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 19.1.0
npm ERR! gyp verb command install [ '19.1.0' ]
npm ERR! gyp verb install input version string "19.1.0"
npm ERR! gyp verb install installing version: 19.1.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 19.1.0
npm ERR! gyp verb build dir attempting to create "build" dir: /home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? /home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-sass/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#<Object>'
npm ERR! gyp ERR! stack     at createConfigFile (/home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-gyp/lib/configure.js:117:21)
npm ERR! gyp ERR! stack     at /home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-gyp/lib/configure.js:84:9
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:188:23)
npm ERR! gyp ERR! System Linux 5.10.16.3-microsoft-standard-WSL2
npm ERR! gyp ERR! command "/home/dimitar/.nvm/versions/node/v19.1.0/bin/node" "/home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/dimitar/Projects/Casa/POC/cxjs/myapp/node_modules/node-sass
npm ERR! gyp ERR! node -v v19.1.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! Node-gyp failed to build your package.
npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
npm ERR! Build failed with error code: 7

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dimitar/.npm/_logs/2022-11-24T15_33_30_953Z-debug-0.log

Ah, node-sass. You might need to update node-sass version manually in package.json as old node-sass versions do not work with newer versions of Node.js.

This should work properly now.