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] Does not install anything. #956

Closed
1 task
trusktr opened this issue Feb 15, 2020 · 4 comments
Closed
1 task

[Bug] Does not install anything. #956

trusktr opened this issue Feb 15, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@trusktr
Copy link

trusktr commented Feb 15, 2020

  • I'd be willing to implement a fix

Describe the bug

I tried running

yarn set version berry
yarn add "code-vue@trusktr/live-code#6085bf5ca1a7faa5ea021a0fc61f6ba08e08030d"
yarn install

in my project which contains an empty package.json ({}), and nothing is installed. There's no node_modules folder after

To Reproduce

Full reproduction:

cd ~
mkdir yarn-test
cd yarn-test
npx yarn set version berry
npx yarn add "code-vue@trusktr/live-code#6085bf5ca1a7faa5ea021a0fc61f6ba08e08030d"
npx yarn install
ls -ld node_modules

and you'll see the final message ls: cannot access 'node_modules': No such file or directory.

Environment if relevant (please complete the following information):

  • OS: [e.g. OSX, Linux, Windows, ...]
  • Node version 13.8.0
  • Yarn version 2.2.0-rc.29
@trusktr trusktr added the bug Something isn't working label Feb 15, 2020
@nicolo-ribaudo
Copy link
Contributor

This is expected: Yarn 2 doesn't generate node_modules (https://yarnpkg.com/features/pnp).

If you want the old behavior, you must create a .yarnrc.yml file containing the nodeLinker: node-modules option.

@trusktr
Copy link
Author

trusktr commented Feb 16, 2020

Hmm, interesting. Why is this? Don't most (all) people expect to see a node_modules folder? EDIT: I just read about PnP. I like the concept.

It reminds me of ied package manager, and npm alternative, that essentially has perfect hoisting using symlinks from node_modules and doesn't need to patch Node at runtime. A project with ied can still accidentally import a dependency from up high though.

@trusktr trusktr closed this as completed Feb 16, 2020
@trusktr
Copy link
Author

trusktr commented Feb 16, 2020

How do I get it to work?

I have an index.js file that imports that one dependency. Then, I have a start script in package.json, and I run yarn start then it has an error:

Error: Couldn't find a suitable Node resolution for the specified unqualified path

Source path: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue/dist/code-vue.umd.js
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue/dist/code-vue.umd.js.js
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue/dist/code-vue.umd.js.json
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue/dist/code-vue.umd.js.node
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue.js
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue.json
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue.node
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue/index.js
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue/index.json
Rejected resolution: /home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue/index.node

Require stack:
- /home/trusktr/tmp/index.js
    at Object.makeError (/home/trusktr/tmp/.pnp.js:5515:24)
    at resolveUnqualified (/home/trusktr/tmp/.pnp.js:14471:29)
    at resolveRequest (/home/trusktr/tmp/.pnp.js:14496:14)
    at Object.resolveRequest (/home/trusktr/tmp/.pnp.js:14558:26)
    at Function.module_1.Module._resolveFilename (/home/trusktr/tmp/.pnp.js:13787:34)
    at Function.module_1.Module._load (/home/trusktr/tmp/.pnp.js:13672:40)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/trusktr/tmp/index.js:1:17)
    at Module._compile (internal/modules/cjs/loader.js:1151:30) {
  code: 'MODULE_NOT_FOUND',
  pnpCode: 'QUALIFIED_PATH_RESOLUTION_FAILED',
  data: {
    unqualifiedPath: '/home/trusktr/tmp/.yarn/cache/code-vue-exotic-8b828e1aaa-2.zip/node_modules/code-vue',
    request: 'code-vue',
    issuer: '/home/trusktr/tmp/'
  },
  requireStack: [ '/home/trusktr/tmp/index.js' ]
}

For now I set that option, nodeLinker: node-modules, and that works.

@sdwlig
Copy link

sdwlig commented Mar 4, 2022

Instead, use yarn node index.js

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

3 participants