Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Never understood the point of using those, I just have a config.json and a single build with empty environment.ts files
    is it possible that the @nrwl/react package does not support decorators (setting the flags in the tsconfig dont help)
    Marc Höffl

    Does anyone have a good way of just executing a script file within a lib?
    lets say I have a ts file within a lib:

    import * as _ from "lodash";
    function run() {['a'], (a) => console.log(a))

    I am trying to execute it via ts-node

            "example": {
              "builder": "@nrwl/workspace:run-commands",
              "options": {
                "command": "yarn ts-node libs/admin/src/scripts/test-script.ts -s"

    But I am getting the following error:

    import * as _ from "lodash";
    SyntaxError: Cannot use import statement outside a module
    Marc Höffl

    Maybe I should rephrase:

    how do you folks run arbitrary scripts in your projects?

    Manuel Bojato
    I have the same question
    But now the second question still waiting for some insight, I read this cooment at but not sure how to use it and where should I put it
    I remember I asked something like that before Marc
    Luis Vargas
    Hello creating a new project with Angular 10 get next error:
     create-nx-workspace 9.5.1
    ? Workspace name (e.g., org name)     simple-chat
    ? What to create in the new workspace angular-nest      [a workspace with a full stack application (Angular + Nest)]
    ? Application name                    client
    ? Default stylesheet format           SASS(.scss)  [   ]
    ? Use the free tier of the distributed cache provided by Nx Cloud? No  [Only use local computation cache]
    Creating a sandbox with Nx...
    new simple-chat --preset="angular-nest" --appName="client" --style="scss" --interactive=false --collection=@nrwl/workspace
    CREATE simple-chat/nx.json (513 bytes)
    CREATE simple-chat/tsconfig.json (509 bytes)
    CREATE simple-chat/ (3407 bytes)
    CREATE simple-chat/.editorconfig (245 bytes)
    CREATE simple-chat/.gitignore (503 bytes)
    CREATE simple-chat/.prettierignore (74 bytes)
    CREATE simple-chat/.prettierrc (26 bytes)
    CREATE simple-chat/angular.json (96 bytes)
    CREATE simple-chat/package.json (1268 bytes)
    CREATE simple-chat/decorate-angular-cli.js (3093 bytes)
    CREATE simple-chat/tools/ (218 bytes)
    CREATE simple-chat/tools/schematics/.gitkeep (0 bytes)
    CREATE simple-chat/apps/.gitkeep (0 bytes)
    CREATE simple-chat/libs/.gitkeep (0 bytes)
    ✔ Packages installed successfully.
    /bin/sh: 1: ./node_modules/.bin/ng: not found
    Workspace creation failed, see above.
    (node:6568) UnhandledPromiseRejectionWarning: Error: Command failed: "/tmp/tmp-6568uTgi4X6nEAny/node_modules/.bin/ng" new simple-chat --preset="angular-nest" --appName="client" --style="scss" --interactive=false --collection=/tmp/tmp-6568uTgi4X6nEAny/node_modules/@nrwl/workspace/collection.json
        at checkExecSyncError (child_process.js:616:11)
        at Object.execSync (child_process.js:652:15)
        at createApp (/home/luis/.npm/_npx/6203/pnpm-global/4/node_modules/.pnpm/create-nx-workspace@9.5.1/node_modules/create-nx-workspace/bin/create-nx-workspace.js:366:21)
        at /home/luis/.npm/_npx/6203/pnpm-global/4/node_modules/.pnpm/create-nx-workspace@9.5.1/node_modules/create-nx-workspace/bin/create-nx-workspace.js:85:25
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:6568) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see (rejection id: 1)
    (node:6568) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    what am I doing wrong?
    Robin Van den Broeck
    Does anybody know how to inject global scss in a Storybook (using angular 9)
    hello, the proxy of react project doesn't work. anyone know why?
    Eran Sakal

    I'm using @nrwl/web:build to build react application. I'm not sure what was the change that I did but when building to production I'm stuck on

    Starting type checking service...
    Using 2 workers with 2048MB memory limit

    Since the log is emitted only after the build ends I don't know what is causing it to hang.

    1. building without production flag works
    2. adding --verbose flag is not propagated to the actual nx build
    3. trying --memoryLimit=4096 doesn't fix it

    Please help

    Eran Sakal

    Setting sourceMap: false and extractCss:false fixed it but obviously i need source maps. regarding extract css, maybe it will work regardless to its value but it doesn't bother me disabling it.

    how can I debug and fix source map issue?

    Mohi 🦀
    I got this error when i want to migrate from workspace@8.8.2 to latest.
    Invalid Version: 5.2
          else throw err
    Error: Command failed: ./node_modules/.bin/tao migrate @nrwl/workspace
    is it possible to lazy load a react lib application to an angular application ?
    if yes could you point me to example or different ways to achieve it ?
    Christopher Dieringer
    hey friends :wave: i have a buildable library for web. it's entirely custom, built with some shell scripts :facepalm:. when my next.js builder executes (the nrwl arch), i want my built artifacts from dist/ to be resolved, as it's buildable! however, i'm not seeing configuration options to say "hey, next builder--use built stuff vs lib/<my-lib>/src".
    Christopher Dieringer
    ...or rather, what i need to do to hint to next that my custom lib is infact buildable. (i thought just having a build step was that)
    Jonas Zunker
    Is there a way to disable the Circular dependency warning for a single typescript library(I use swagger-codegen which unfortunately generates code with circular dependencies)?
    Quick one about odd test failures. I've recently migrated an existing monorepo (seven libs, two apps) to Nx and Angular 9. I'm able to build, serve and lint all projects, as well as execute tests against libraries. However, tests against some app tests fail:
    ● NoteItemComponent › HTML › should have <core-item> element
        Failed: "Zone is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/dist/zone.js"
          11 |   let fixture: ComponentFixture<NoteItemComponent>;
          12 |
        > 13 |   beforeEach(async(() => {
             |   ^
          14 |     TestBed.configureTestingModule({
          15 |       imports: [
          16 |         AppTestModule,
          at Env.beforeEach (../../node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:41:24)
          at Suite.<anonymous> (src/spec/components/note-item.component.spec.ts:13:3)
          at Object.<anonymous> (src/spec/components/note-item.component.spec.ts:9:1)

    I've done Google due diligence on this:

    • Yes, I'm including zone.js. I've followed Jest test setup per a comparative project.
    • All libs and apps have the same top-level configurations for tests.
    • I've flushed out node modules and jest cache repeatedly.

    I'm stumped about where to investigate next for a possible solution.

    To answer my own question, adding setupFilesAfterEnv: ['./src/test-setup.ts']` to jest.config.ts per this fixed it:
    Hi has anyone got Angular9+ in an NX workspace working with Storybook using Scss / Sass ?
    Are there any working guides? It is not working for me so I am probably doing something wrong.
    (new to Storybook & NX)
    The app works fine - the Sass is used with no problems, but is ignored in Storybook.
    I have followed many examples but the styles are not getting applied.
    I have a Lib with a Storybook config, works fine when running the App, but Scss style is ignored when running Lib in Storybook.
    Does anyone know where to put a typeorm ormconfig.json file so that the createconnection function can find it?
    Luis Vargas
    in the app root
    I have it there but I am still getting No connection options were found in any orm config file
    Luis Vargas
    can I see your code?
    or an example repo?
    1 reply
    Ming-der Wang
    any can help? I'm new in nx, why I always get "SyntaxError: Unexpected token ..." "options: { ...options }," in my nx environment in any nx command? BTW, this error only happen in Visual Studio code plugin "Nx Console", not in command line. why? (Nx Console version v12.0.0)
    Ming-der Wang
    I think the problem is I'm normally using zsh, but the nx console force to use bash.
    can we somehow define directory for these static assets?
    It can be an object with more info (glob, input, output, etc)
    I mean, each element in the array can be an object
    is there an example of that somewhere?
    Thank you so much @rraziel
    Hm maybe someone had that issue as well: I have a lib's code in modules/libname/src/\*, both .ts and .spec.ts, and another lib's code in modules/libname/otherlibname/src/\*
    When I run nx test libname, it picks the .spec.ts from otherlibname (since it's */.spec.ts, mostly)
    I tried setting testMatch to ./src/**/*.spec.ts or <rootDir>/modules/libname/etc... but then they don't find any files
    Oh also, I should probably open a ticket on Github, but the caching doesn't take into account changes made to jest.config.js files inherited via preset (so if I change the repo/jest.config.js it just tells me "it's ok bro we got it cached" because it doesn't see a change in repo/modules/libname/jest.config.js)
    I get it to work with testMatch: ['**/modules/libname/src/**/*.spec.ts'] though, so maybe I'll have to just live with that one
    Also another potential bug, doing nx test xx --no-cache runs with --cache=false but it still shows me the cached output
    Hey, looking for a little bit of help with NPM packaging. I have a NX workspace with multiple react libraries and i'm trying to expose them as a single npm package, but can seem to get the nx build to bundle any dependancies so just get a bunch of 404's on my import/export of "@someScope/someLibrary". Has anyone got any experience with this? I can't seem to find anything via the usual avenues :(
    You mean all libs under the same @somescope/somelib or one at @somescope/somelib and the others at @somescope/somelib/otherlib1,2,3,4?
    all libs have different paths "@someScope/1", "@someScope/2" etc
    Sounds like you just need them to be publishable?
    (e.g. when you create with --publishable)