analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.46k stars 227 forks source link

[Bug] An unhandled exception occurred: Workspaces is not a constructor #1169

Closed dolanmiu closed 1 day ago

dolanmiu commented 1 month ago

Please provide the environment you discovered this bug in.

Windows 10 Angular 17.3

Which area/package is the issue in?

create-analog

Description

I get the following error while following the migration guide:

https://analogjs.org/docs/guides/migrating

I am using Angular workspaces

> ng serve front -c development --port 4203

An unhandled exception occurred: Workspaces is not a constructor
See "C:\Users\Dolan\AppData\Local\Temp\ng-1KQf8T\angular-errors.log" for further details.

Please provide the exception or error you saw

This is the full error in angular-errors.log:


[error] TypeError: Workspaces is not a constructor
    at readTargetOptions (C:\Users\Dolan\Documents\Git\Fluid-Paper\spa\node_modules\@nx\vite\node_modules\@nx\devkit\src\executors\read-target-options.js:26:16)
    at getNxTargetOptions (C:\Users\Dolan\Documents\Git\Fluid-Paper\spa\node_modules\@nx\vite\src\utils\options-utils.js:97:42)
    at viteDevServerExecutor (C:\Users\Dolan\Documents\Git\Fluid-Paper\spa\node_modules\@nx\vite\src\executors\dev-server\dev-server.impl.js:30:69)


### Other information

_No response_

### I would be willing to submit a PR to fix this issue

- [ ] Yes
- [X] No
brandonroberts commented 1 month ago

Can you share what's in your package.json?

dolanmiu commented 1 month ago

Here is the package.json:

{
  "name": "spa",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build:console:prod": "ng build console --localize --configuration=production && ng build console --configuration=production --delete-output-path=false",
    "build:studio-preview:prod": "ng build studio-preview --configuration=production",
    "build:global-shared": "cd ../global-shared && npm run build:constants -- --outDir=../../../spa/dist/global-shared/constants && npm run build:models -- --outDir=../../../spa/dist/global-shared/models && npm run build:util -- --outDir=../../../spa/dist/global-shared/util",
    "build:admin-spa:prod": "ng build admin-spa --configuration=production",
    "build:common:prod": "ng build common --configuration=production",
    "build:monaco:prod": "ng build monaco --configuration=production",
    "build:dependencies": "npm run build:global-shared && npm run build:common:prod && npm run build:monaco:prod",
    "build:front:prod": "ng build front --localize --configuration=production",
    "e2e": "ng e2e",
    "lint": "ng lint",
    "lint:console": "npm run lint -- console",
    "lint:admin-spa": "npm run lint -- admin-spa",
    "lint:studio-preview": "npm run lint -- studio-preview",
    "lint:front": "npm run lint -- front",
    "ng": "ng",
    "prettier": "prettier -l .",
    "prettier:fix": "npm run prettier -- --write",
    "cspell": "cspell  \"/**/*.{ts,scss,html}\"",
    "start:console": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve -c development console",
    "start:console:local": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve -c local console",
    "start:studio-preview": "ng serve studio-preview -c development --port 4201",
    "start:admin-spa": "ng serve admin-spa -c development --port 4202",
    "start:front": "ng serve front -c development --port 4203",
    "start:front:fr": "ng serve front -c development-fr --port 4203",
    "start:mobile": "ionic serve --project mobile-app",
    "start:mobile:ios": "npm run build:mobile && ionic cap run ios -l --external --open --project mobile-app",
    "build:mobile": "ionic build --project mobile-app",
    "predeploy:console": "npm run build:console:prod",
    "deploy:console": "firebase deploy --only hosting:fluid-paper",
    "predeploy:studio-preview": "npm run build:studio-preview:prod",
    "deploy:studio-preview": "firebase deploy --only hosting:studio-preview",
    "deploy:front": "cross-env FIREBASE_FRAMEWORKS_BUILD_TARGET=front:build:production firebase deploy --only hosting:fluid-paper-front",
    "i18n:extract:front": "ng extract-i18n front --output-path projects/front/src/locale",
    "i18n:extract:console": "ng extract-i18n console --output-path projects/console/src/locale",
    "test": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng test"
  },
  "dependencies": {
    "@angular/animations": "^18.0.3",
    "@angular/cdk": "^18.0.3",
    "@angular/common": "^18.0.3",
    "@angular/compiler": "^18.0.3",
    "@angular/core": "^18.0.3",
    "@angular/fire": "^18.0.1",
    "@angular/forms": "^18.0.3",
    "@angular/material": "^18.0.3",
    "@angular/platform-browser": "^18.0.3",
    "@angular/platform-browser-dynamic": "^18.0.3",
    "@angular/platform-server": "^18.0.3",
    "@angular/router": "^18.0.3",
    "@angular/service-worker": "^18.0.3",
    "@angular/ssr": "^18.0.4",
    "@babel/standalone": "^7.18.8",
    "@capacitor/app": "5.0.7",
    "@capacitor/core": "5.7.1",
    "@capacitor/haptics": "5.0.7",
    "@capacitor/keyboard": "5.0.8",
    "@capacitor/status-bar": "5.0.7",
    "@fortawesome/fontawesome-pro": "^6.4.0",
    "@ionic/angular": "^7.7.3",
    "@types/babel__core": "^7.1.19",
    "@types/babel__standalone": "^7.1.4",
    "@types/body-scroll-lock": "^3.1.0",
    "@types/lodash.isequal": "^4.5.6",
    "@types/luxon": "^3.3.5",
    "@types/marked": "^4.0.8",
    "@types/numeral": "^2.0.1",
    "@types/shopify-buy": "^2.17.1",
    "algoliasearch": "^4.8.5",
    "body-scroll-lock": "^4.0.0-beta.0",
    "check-password-strength": "^2.0.3",
    "constrained-editor-plugin": "^1.2.1",
    "daisyui": "^3.9.4",
    "express": "^4.18.2",
    "firebase": "^10.6.0",
    "interactjs": "^1.10.17",
    "lodash.isequal": "^4.5.0",
    "luxon": "^3.4.4",
    "marked": "^9.1.6",
    "monaco-editor": "^0.44.0",
    "ngx-clipboard": "^16.0.0",
    "ngx-markdown": "^18.0.0",
    "numeral": "^2.0.6",
    "obscenity": "^0.2.1",
    "path-browserify": "^1.0.1",
    "qrcode": "^1.4.4",
    "rxfire": "^6.0.5",
    "rxjs": "~7.8.0",
    "shopify-buy": "^2.20.1",
    "tailwind-gradient-mask-image": "^1.2.0",
    "tailwind-scrollbar": "^3.0.4",
    "tslib": "^2.0.0",
    "unique-names-generator": "^4.7.1",
    "zone.js": "~0.14.2"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "^18.0.0",
    "@angular-devkit/architect": "0.1800.4",
    "@angular-devkit/build-angular": "^18.0.4",
    "@angular-eslint/builder": "^18.0.1",
    "@angular-eslint/eslint-plugin": "^18.0.1",
    "@angular-eslint/eslint-plugin-template": "^18.0.1",
    "@angular-eslint/schematics": "^18.0.1",
    "@angular-eslint/template-parser": "^18.0.1",
    "@angular/cli": "^18.0.4",
    "@angular/compiler-cli": "^18.0.3",
    "@angular/localize": "^18.0.3",
    "@capacitor/cli": "5.7.1",
    "@capacitor/ios": "^5.7.1",
    "@ionic/angular-toolkit": "latest",
    "@types/express": "^4.17.17",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^18.19.3",
    "@types/qrcode": "^1.4.0",
    "@types/tailwindcss": "2.2.1",
    "@typescript-eslint/eslint-plugin": "5.59.7",
    "@typescript-eslint/parser": "5.59.7",
    "autoprefixer": "^10.4.7",
    "browser-sync": "^3.0.0",
    "cross-env": "^7.0.3",
    "cspell": "^5.6.6",
    "css-loader": "^6.7.1",
    "eslint": "^8.40.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-functional": "^5.0.8",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-jsdoc": "^39.6.4",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-tailwindcss": "^3.13.0",
    "file-loader": "^6.2.0",
    "jasmine-auto-spies": "^6.9.8",
    "jasmine-core": "~3.8.0",
    "karma": "~6.3.3",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.7.0",
    "monaco-editor-webpack-plugin": "^7.0.1",
    "ng-mocks": "^14.13.0",
    "ng-packagr": "^18.0.0",
    "postcss": "^8.4.14",
    "prettier": "^3.3.2",
    "style-loader": "^3.3.1",
    "tailwindcss": "^3.0.24",
    "typescript": "~5.4.5"
  },
  "optionalDependencies": {
    "@nx/nx-darwin-arm64": "19.0.4",
    "@nx/nx-darwin-x64": "19.0.4",
    "@nx/nx-linux-x64-gnu": "19.0.4",
    "@nx/nx-win32-x64-msvc": "19.0.4"
  },
  "workspaces": [
    "packages/monaco-editor-auto-typings"
  ]
}
dolanmiu commented 1 month ago

Issue seems to have gone away now after starting over and re-running the command. Maybe transient error

But having new issues

It has no errors, but nothing shows up on the dev server. I am using path in my tsconfig. I have tried to install https://www.npmjs.com/package/vite-tsconfig-paths, but didn't work

http://localhost:4203/api works though

image image

Does this diff for angular.json look good? It has deleted my styles:

image image

brandonroberts commented 1 month ago

Did you move the index.html to the root of the project? That's usually the case for the page not found on startup.

brandonroberts commented 4 weeks ago

I think you need to set the root back to projects/frontend and make sure the index.html is at projects/frontend/index.html

And update the options to include the project/frontend path along with the filename

brandonroberts commented 1 day ago

Feel free to reopen if this is still an issue