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

[Bug?]: The locator that owns the path can't be found inside the dependency tree (this is probably an internal error) with webpack on Windows #6231

Open
1 task
pigrammer3 opened this issue Apr 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@pigrammer3
Copy link

Self-service

  • I'd be willing to implement a fix

Describe the bug

I was building a package with TypeScript and Webpack, and decided to migrate from 1.x to 4.x and PnP. I did so, and got the following error (trace anonymized) (this error is not from my real project, it's from the MRE below):

$ yarn webpack
C:\Users\pigrammer\project\.pnp.cjs:6919
      Error.captureStackTrace(firstError);
            ^

Error: Your application tried to access import-local, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

Required package: import-local
Required by: C:\Users\pigrammer\project\.yarn\__virtual__\webpack-cli-virtual-7ee12da31b\3\AppData\Local\Yarn\Berry\cache\webpack-cli-npm-5.1.4-7be5b53b38-10c0.zip\node_modules\webpack-cli\bin\

Require stack:
- C:\Users\pigrammer\project\.yarn\__virtual__\webpack-cli-virtual-7ee12da31b\3\AppData\Local\Yarn\Berry\cache\webpack-cli-npm-5.1.4-7be5b53b38-10c0.zip\node_modules\webpack-cli\bin\cli.js
- C:\Users\pigrammer\project\.yarn\__virtual__\webpack-virtual-e455d0f00e\3\AppData\Local\Yarn\Berry\cache\webpack-npm-5.91.0-5571fb1057-10c0.zip\node_modules\webpack\bin\webpack.js
    at require$$0.Module._resolveFilename (C:\Users\pigrammer\project\.pnp.cjs:6919:13)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at require$$0.Module._load (C:\Users\pigrammer\project\.pnp.cjs:6810:31)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (C:\Users\pigrammer\project\.yarn\__virtual__\webpack-cli-virtual-7ee12da31b\3\AppData\Local\Yarn\Berry\cache\webpack-cli-npm-5.1.4-7be5b53b38-10c0.zip\node_modules\webpack-cli\bin\cli.js:5:21)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at require$$0.Module._extensions..js (C:\Users\pigrammer\project\.pnp.cjs:6962:33)
    at Module.load (node:internal/modules/cjs/loader:1207:32)

Node.js v20.10.0

I then ran
yarn add --dev import-local
to try to fix this, even though I did not actually use this package. I succeeded in getting a different error:

C:\Users\pigrammer\project\.pnp.cjs:6921
      Error.captureStackTrace(firstError);
            ^

Error: The locator that owns the "/C:/Users/pigrammer/project/Yarn/Berry/cache/import-local-npm-3.1.0-8960af5e51-10c0.zip/node_modules/import-local/" path can't be found inside the dependency tree (this is probably an internal error)
Require stack:
- C:\Users\pigrammer\project\.yarn\__virtual__\webpack-cli-virtual-7ee12da31b\3\AppData\Local\Yarn\Berry\cache\webpack-cli-npm-5.1.4-7be5b53b38-10c0.zip\node_modules\webpack-cli\bin\cli.js
- C:\Users\pigrammer\project\.yarn\__virtual__\webpack-virtual-e455d0f00e\3\AppData\Local\Yarn\Berry\cache\webpack-npm-5.91.0-5571fb1057-10c0.zip\node_modules\webpack\bin\webpack.js
    at require$$0.Module._resolveFilename (C:\Users\pigrammer\project\.pnp.cjs:6921:13)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at require$$0.Module._load (C:\Users\pigrammer\project\.pnp.cjs:6812:31)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (C:\Users\pigrammer\project\.yarn\__virtual__\webpack-cli-virtual-7ee12da31b\3\AppData\Local\Yarn\Berry\cache\webpack-cli-npm-5.1.4-7be5b53b38-10c0.zip\node_modules\webpack-cli\bin\cli.js:5:21)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at require$$0.Module._extensions..js (C:\Users\pigrammer\project\.pnp.cjs:6964:33)
    at Module.load (node:internal/modules/cjs/loader:1207:32)

Node.js v20.10.0

I would appreciate if this could be fixed.

To reproduce

Package.json:

{
  "name": "example",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "packageManager": "yarn@4.1.1",
  "devDependencies": {
    "import-local": "^3.1.0",
    "webpack": "^5.91.0",
    "webpack-cli": "^5.1.4"
  }
}

This happens the same whether I have webpack.config.js or whether I don't have it. It occurs even in an empty project with no source files.

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
  Binaries:
    Node: 20.10.0 - ~\AppData\Local\Temp\xfs-b058d8a7\node.CMD
    Yarn: 4.1.1 - ~\AppData\Local\Temp\xfs-b058d8a7\yarn.CMD
    npm: 10.2.5 - C:\Program Files\nodejs\npm.CMD

Additional context

No response

@pigrammer3 pigrammer3 added the bug Something isn't working label Apr 16, 2024
@pigrammer3 pigrammer3 changed the title [Bug?]: The locator that owns the path can't be found inside the dependency tree (this is probably an internal error) [Bug?]: The locator that owns the path can't be found inside the dependency tree (this is probably an internal error) with webpack on Windows Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant