question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@angular-devkit/core/src/experimental/workspace blocks react or next application.

See original GitHub issue

Hi when I use pnpm to create workspace nest application works but when I try to run any react related application I came cross with this error.

npm: working pnpm: not working yarn 2: not working

Cannot find module '@angular-devkit/core/src/experimental/workspace'
Require stack:
- /home/murat/Projects/blacksolutions/service-module/node_modules/.pnpm/@nrwl/next@10.4.4_36391234cc8ee784ed2def87da7d4058/node_modules/@nrwl/next/src/schematics/application/lib/add-project.js
- /home/murat/Projects/blacksolutions/service-module/node_modules/.pnpm/@nrwl/next@10.4.4_36391234cc8ee784ed2def87da7d4058/node_modules/@nrwl/next/src/schematics/application/application.js
- /home/murat/Projects/blacksolutions/service-module/node_modules/.pnpm/@angular-devkit/schematics@10.1.7/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /home/murat/Projects/blacksolutions/service-module/node_modules/.pnpm/@angular-devkit/schematics@10.1.7/node_modules/@angular-devkit/schematics/tools/index.js
- /home/murat/Projects/blacksolutions/service-module/node_modules/.pnpm/@nrwl/tao@10.4.4/node_modules/@nrwl/tao/src/commands/generate.js
- /home/murat/Projects/blacksolutions/service-module/node_modules/.pnpm/@nrwl/tao@10.4.4/node_modules/@nrwl/tao/index.js
- /home/murat/Projects/blacksolutions/service-module/node_modules/.pnpm/@nrwl/cli@10.4.4/node_modules/@nrwl/cli/lib/init-local.js
- /home/murat/Projects/blacksolutions/service-module/node_modules/.pnpm/@nrwl/cli@10.4.4/node_modules/@nrwl/cli/bin/nx.js

Steps to Reproduce

pnpx create-nx-workspace --preset empty “pnpx add @nrwl/next @nrwl/nest @nrwl/react …” rm -rf node_modules pnpm install

my package.json

{
  "name": "service-module",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "nx": "nx",
    "start": "nx serve",
    "build": "nx build",
    "test": "nx test",
    "lint": "nx workspace-lint && nx lint",
    "e2e": "nx e2e",
    "affected:apps": "nx affected:apps",
    "affected:libs": "nx affected:libs",
    "affected:build": "nx affected:build",
    "affected:e2e": "nx affected:e2e",
    "affected:test": "nx affected:test",
    "affected:lint": "nx affected:lint",
    "affected:dep-graph": "nx affected:dep-graph",
    "affected": "nx affected",
    "format": "nx format:write",
    "format:write": "nx format:write",
    "format:check": "nx format:check",
    "update": "nx migrate latest",
    "workspace-schematic": "nx workspace-schematic",
    "dep-graph": "nx dep-graph",
    "help": "nx help"
  },
  "private": true,
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/preset-env": "^7.12.7",
    "@babel/preset-react": "7.9.4",
    "@babel/preset-typescript": "7.12.7",
    "@cypress/webpack-preprocessor": "^5.4.11",
    "@nestjs/schematics": "^7.0.0",
    "@nestjs/testing": "^7.0.0",
    "@nrwl/cli": "10.4.4",
    "@nrwl/cypress": "10.4.4",
    "@nrwl/eslint-plugin-nx": "10.4.4",
    "@nrwl/jest": "10.4.4",
    "@nrwl/nest": "^10.4.4",
    "@nrwl/next": "^10.4.4",
    "@nrwl/node": "10.4.4",
    "@nrwl/react": "^10.4.4",
    "@nrwl/storybook": "^10.4.4",
    "@nrwl/tao": "10.4.4",
    "@nrwl/web": "10.4.4",
    "@nrwl/workspace": "10.4.4",
    "@testing-library/react": "11.1.2",
    "@types/jest": "26.0.8",
    "@types/node": "^14.14.10",
    "@types/react": "16.9.56",
    "@types/react-dom": "16.9.9",
    "@typescript-eslint/eslint-plugin": "4.3.0",
    "@typescript-eslint/parser": "4.3.0",
    "babel-jest": "26.2.2",
    "babel-loader": "^8.2.2",
    "cypress": "^6.0.0",
    "dotenv": "^8.2.0",
    "eslint": "^7.14.0",
    "eslint-config-prettier": "6.0.0",
    "eslint-plugin-cypress": "^2.10.3",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsx-a11y": "6.4.1",
    "eslint-plugin-react": "7.21.5",
    "eslint-plugin-react-hooks": "^4.2.0",
    "jest": "26.2.2",
    "next": "^10.0.3",
    "prettier": "^2.2.1",
    "ts-jest": "26.4.0",
    "ts-node": "~9.0.0",
    "typescript": "~4.1.2",
    "webpack": "^5.9.0"
  },
  "dependencies": {
    "@nestjs/common": "^7.0.0",
    "@nestjs/core": "^7.0.0",
    "@nestjs/platform-express": "^7.0.0",
    "document-register-element": "1.13.1",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "reflect-metadata": "^0.1.13",
    "rxjs": "~6.5.5",
    "tslib": "^2.0.0"
  },
  "pnpm": {
    "overrides": {
      "eslint-plugin-react-hooks": "^4.2.0",
      "@cypress/webpack-preprocessor": "^5.4.11"
    }
  }
}

node_modules/@nrwl/tao/src/compat/compat.js has this content in it. according to this https://github.com/nrwl/nx/issues/4100#issuecomment-732371603

Angular dev-kit moved workspace from experimental to src folder

/* eslint-disable */
const Module = require('module');
const originalRequire = Module.prototype.require;
Module.prototype.require = function () {
    const result = originalRequire.apply(this, arguments);
    if (arguments[0].startsWith('@angular-devkit/core')) {
        const Workspace = originalRequire.apply(this, [
            `@angular-devkit/core/src/experimental/workspace`,
        ]).Workspace;
        Workspace._workspaceFileNames = [
            'workspace.json',
            ...Workspace._workspaceFileNames,
        ];
        const core = originalRequire.apply(this, [
            `@angular-devkit/core/src/workspace/core`,
        ]);
        core._test_addWorkspaceFile('workspace.json', core.WorkspaceFormat.JSON);
    }
    return result;
};
try {
    require('@angular-devkit/build-angular/src/utils/version').Version.assertCompatibleAngularVersion = () => { };
}
catch (e) { }
try {
    require('@angular-devkit/build-angular/src/utils/version').assertCompatibleAngularVersion = () => { };
}
catch (e) { }
//# sourceMappingURL=compat.js.map

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
KyleBastiencommented, Dec 14, 2020

I’m seeing the same error here when migrating from Nx 10.2 to Nx 11. I added a resolution to my package.json to point @angular-devkit/core to 10.2.0 while running the migration, and then it worked. I then was able to remove this resolution and everything seems happy so far.

1reaction
muratbesercommented, Nov 30, 2020

I read out the package-lock.json file and locked the versions of

    "@angular-devkit/architect": "0.1001.7",
    "@angular-devkit/core": "10.1.7",
    "@angular-devkit/schematics": "10.1.7"

and next application works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build and Deploy a Full Stack App From scratch - YouTube
We'll also learn how to deploy the App using Vercel and to s... ... Next.js React Framework Course – Build and Deploy a...
Read more >
What is Next.js?
Next.js is a flexible React framework that gives you building blocks to create fast web applications. But what exactly do we mean by...
Read more >
Create a New React App
If you're learning React or creating a new single-page app, use Create React App. If you're building a server-rendered website with Node.js, try...
Read more >
Next.js vs React: What are the differences? - Imaginary Cloud
js, but Next.js uses React to deploy apps. React has a dedicated framework called Create React App (CRA), an application used to set...
Read more >
Next.js vs. React: The Difference & Best Frontend Framework
Sometimes it makes more sense to use React than Next.js and vice versa. ... For React users already familiar with Create React App, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found