Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find module "@angular-devkit/build-angular" from "/app/angular/yarn-pnp" #7746

Closed
laurencefass opened this issue Dec 9, 2019 · 5 comments

Comments

@laurencefass
Copy link

laurencefass commented Dec 9, 2019

same error applicable to yarn versions 1.19.1, and 2.0.0-rc.19

Do you want to request a feature or report a bug?

critical bug

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce.

i started with a working angular project and added

  "installConfig": {
    "pnp": true
  },

to package.json as per instructions and removeed node_modules folder.

running yarn install creates .pnp folder and .pnp.js file. looks ok and im happy to post contents if needed.

yarn start results in error:
please note yarn start is defined as: "ng serve --host 0.0.0.0 --port 3603 --disable-host-check ..."


bash-4.4# yarn start
yarn run v1.19.1
warning package.json: "dependencies" has dependency "jasmine-core" with range "2.99.1" that collides with a dependency in "devDependencies" of the same name with version "~2.99.1"
$ ng serve --host 0.0.0.0 --port 3603 --disable-host-check --public-host https://angular.syntapse.co.uk/nested-heroes/sockjs-node/
Could not find module "@angular-devkit/build-angular" from "/app/angular/yarn-pnp".
Error: Could not find module "@angular-devkit/build-angular" from "/app/angular/yarn-pnp".
    at Object.resolve (/usr/local/share/.cache/yarn/v6/npm-@angular-devkit-core-7.0.7-665176ad8421adfd5f3ea0b2c4a9a432a158b1bb-integrity/node_modules/@angular-devkit/core/node/resolve.js:141:11)
    at Observable.rxjs_1.Observable [as _subscribe] (/usr/local/share/.cache/yarn/v6/npm-@angular-devkit-architect-0.10.7-c74b9f6b7f1b4261ada2d24c832328aa4c394464-integrity/node_modules/@angular-devkit/architect/src/architect.js:132:40)
    at Observable._trySubscribe (/usr/local/share/.cache/yarn/v6/npm-rxjs-6.3.3-3c6a7fa420e844a81390fb1158a9ec614f4bad55-integrity/node_modules/rxjs/internal/Observable.js:44:25)
    at Observable.subscribe (/usr/local/share/.cache/yarn/v6/npm-rxjs-6.3.3-3c6a7fa420e844a81390fb1158a9ec614f4bad55-integrity/node_modules/rxjs/internal/Observable.js:30:22)
    at /usr/local/share/.cache/yarn/v6/npm-rxjs-6.3.3-3c6a7fa420e844a81390fb1158a9ec614f4bad55-integrity/node_modules/rxjs/internal/Observable.js:99:19
    at new Promise (<anonymous>)
    at Observable.toPromise (/usr/local/share/.cache/yarn/v6/npm-rxjs-6.3.3-3c6a7fa420e844a81390fb1158a9ec614f4bad55-integrity/node_modules/rxjs/internal/Observable.js:97:16)
    at ServeCommand.initialize (/usr/local/share/.cache/yarn/v6/npm-@angular-cli-7.0.7-0f4500c5fcf22694c9c40f14d2a5b3dc90fbb4a3-integrity/node_modules/@angular/cli/models/architect-command.js:91:94)
    at process._tickCallback (internal/process/next_tick.js:43:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:763:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

this package is clearly part of the build and specified in the package.json.

What is the expected behavior?

yarn start should start application without dependency errors.

Please mention your node.js, yarn and operating system version.

bash-4.4# yarn -v
1.19.1
bash-4.4# node --version
v11.1.0
os: debian.

@laurencefass
Copy link
Author

laurencefass commented Dec 10, 2019

I have also tried the same thing on a fresh application generated today with ng new command and im seeing the same error so this is affecting default package.json.

@laurencefass
Copy link
Author

.pnp.js contains the following entry for the offending package:


  ["@angular-devkit/build-angular", new Map([
    ["0.800.0", {
      packageLocation: path.resolve(__dirname, "../../../usr/local/share/.cache/yarn/v6/npm-@angular-devkit-build-angular-0.800.0-6be1a0268daeadc7f07a73f1a1ec2759e4a0965b-integrity/node_modules/@angular-devkit/build-angular/"),
      packageDependencies: new Map([
        ["typescript", "3.5.3"],
        ["@angular-devkit/architect", "0.800.0"],
        ["@angular-devkit/build-optimizer", "0.800.0"],
        ["@angular-devkit/build-webpack", "0.800.0"],
        ["@angular-devkit/core", "8.0.0"],
        ["@ngtools/webpack", "8.0.0"],
        ["ajv", "6.10.0"],
        ["autoprefixer", "9.5.1"],
        ["browserslist", "4.5.5"],
        ["caniuse-api", "3.0.0"],
        ["circular-dependency-plugin", "5.0.2"],
        ["clean-css", "4.2.1"],
        ["copy-webpack-plugin", "5.0.2"],
        ["core-js", "3.0.1"],
        ["file-loader", "3.0.1"],
        ["glob", "7.1.3"],
        ["istanbul-instrumenter-loader", "3.0.1"],
        ["karma-source-map-support", "1.4.0"],
        ["less", "3.9.0"],
        ["less-loader", "4.1.0"],
        ["license-webpack-plugin", "2.1.1"],
        ["loader-utils", "1.2.3"],
        ["mini-css-extract-plugin", "0.6.0"],
        ["minimatch", "3.0.4"],
        ["open", "6.2.0"],
        ["parse5", "4.0.0"],
        ["postcss", "7.0.14"],
        ["postcss-import", "12.0.1"],
        ["postcss-loader", "3.0.0"],
        ["raw-loader", "1.0.0"],
        ["rxjs", "6.4.0"],
        ["sass", "1.19.0"],
        ["sass-loader", "7.1.0"],
        ["semver", "6.0.0"],
        ["source-map-loader", "0.2.4"],
        ["source-map-support", "0.5.12"],
        ["speed-measure-webpack-plugin", "1.3.1"],
        ["stats-webpack-plugin", "0.7.0"],
        ["style-loader", "0.23.1"],
        ["stylus", "0.54.5"],
        ["stylus-loader", "3.0.2"],
        ["terser-webpack-plugin", "1.2.3"],
        ["tree-kill", "1.2.1"],
        ["webpack", "4.30.0"],
        ["webpack-dev-middleware", "3.6.2"],
        ["webpack-dev-server", "3.3.1"],
        ["webpack-merge", "4.2.1"],
        ["webpack-sources", "1.3.0"],
        ["webpack-subresource-integrity", "1.1.0-rc.6"],
        ["worker-plugin", "3.1.0"],
        ["@angular-devkit/build-angular", "0.800.0"],
      ]),
    }],
  ])],

@laurencefass
Copy link
Author

The referenced folder appears to exist:

 ls -la ../../../usr/local/share/.cache/yarn/v6/npm-@angular-devkit-build-angular-0.800.0-6be1a0268daeadc7f07a73f1a1ec2759e4a0965b-integrity/node_modules/@angular-devkit/build-angular
total 116
drwxr-xr-x    5 root     root          4096 Dec 10 16:03 .
drwxr-xr-x    3 root     root          4096 Dec 10 16:03 ..
-rw-r--r--    1 root     root          4861 Dec 10 16:03 .yarn-metadata.json
-rw-r--r--    1 root     root         72390 Dec 10 16:03 .yarn-tarball.tgz
-rw-r--r--    1 root     root          1073 Dec 10 16:03 LICENSE
-rw-r--r--    1 root     root            35 Dec 10 16:03 README.md
-rw-r--r--    1 root     root          1473 Dec 10 16:03 builders.json
-rw-r--r--    1 root     root          2424 Dec 10 16:03 package.json
drwxr-xr-x    3 root     root          4096 Dec 10 16:03 plugins
drwxr-xr-x   12 root     root          4096 Dec 10 16:03 src
drwxr-xr-x    2 root     root          4096 Dec 10 16:03 test

@laurencefass
Copy link
Author

error log file:

bash-4.4# cat /tmp/ng-GEJffj/angular-errors.log
[error] Error: Could not find module "@angular-devkit/build-angular" from "/app/angular/ng-yarn-pnp".
    at Object.resolve (/usr/local/share/.cache/yarn/v6/npm-@angular-devkit-core-8.3.20-8a9e17e706905efab9875c16690e1d9328c9d5dd-integrity/node_modules/@angular-devkit/core/node/resolve.js:154:11)
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (/usr/local/share/.cache/yarn/v6/npm-@angular-devkit-architect-0.803.20-792093259d69012c0763aa9176181b255d8795c8-integrity/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js:31:40)
    at ServeCommand.initialize (/app/angular/ng-yarn-pnp/.pnp/unplugged/npm-@angular-cli-8.3.20-63e8f626e7dcf37e73cda820ab38bcac13423326-integrity/node_modules/@angular/cli/models/architect-command.js:71:63)
    at process._tickCallback (internal/process/next_tick.js:43:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:763:11)
    at startup (internal/bootstrap/node.js:308:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)bash-4.4

@merceyz
Copy link
Member

merceyz commented Jan 2, 2021

PnP support for angular is tracked in yarnpkg/berry#266

@merceyz merceyz closed this as completed Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants