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

Fresh install with pnpm isn't working #7106

Open
ReSpawN opened this issue Apr 14, 2022 · 21 comments
Open

Fresh install with pnpm isn't working #7106

ReSpawN opened this issue Apr 14, 2022 · 21 comments

Comments

@ReSpawN
Copy link

ReSpawN commented Apr 14, 2022

Version

5.0.4

Reproduction link

cli.vuejs.org

Environment info

  System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
  Binaries:
    Node: 16.14.2 - /usr/bin/node
    Yarn: 1.22.15 - /usr/bin/yarn
    npm: 8.6.0 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmGlobalPackages:
    @vue/cli: 5.0.4


PNPM version is 7.0.0-rc.3 (I also tested rc.2)

Steps to reproduce

Regular vue create project-name. Manual or default 3.x install doesn't matter.
In the end, choose PNPM as your package manager (or launch with --packageManager=pnpm)

What is expected?

A cleanly installed project

What is actually happening?

No install except the basic generation of the required package.json and other related files (no node_modules)

Error: command failed: pnpm install --reporter silent --shamefully-hoist
    at ChildProcess.<anonymous> (/usr/lib/node_modules/@vue/cli/lib/util/executeCommand.js:138:16)
    at ChildProcess.emit (node:events:526:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)```

---
I added a link to the Vue CLI docs as I didn't know where to start up this code. StackBlitz and Codepen both basically generate the project for you, but that step before is actually what's going wrong.

<!-- generated by vue-issues. DO NOT REMOVE -->
@rumbis
Copy link

rumbis commented Apr 15, 2022

i got the same issue did you find a solution ?

@ReSpawN
Copy link
Author

ReSpawN commented Apr 15, 2022

I did not. I chose NPM as my installer and it works fine for now. I loved the way PNPM works but together they just don't work yet. (edited as I mistakenly thought this ticket was about Nuxt3)

@ReSpawN ReSpawN closed this as completed Apr 15, 2022
@ReSpawN ReSpawN reopened this Apr 15, 2022
@Hergeirs
Copy link

Hergeirs commented May 6, 2022

Any update on this?
I get the same error when adding a vue plugin to my existing project

$ vue add tauri                                                                   

📦  Installing vue-cli-plugin-tauri...

 ERROR  Error: command failed: pnpm install --reporter silent --shamefully-hoist vue-cli-plugin-tauri -D
Error: command failed: pnpm install --reporter silent --shamefully-hoist vue-cli-plugin-tauri -D
    at ChildProcess.<anonymous> (/usr/lib/node_modules/@vue/cli/lib/util/executeCommand.js:138:16)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

Running the command pnpm install --reporter silent --shamefully-hoist vue-cli-plugin-tauri -D works without issue by itself.

@Hergeirs
Copy link

Hergeirs commented May 6, 2022

Figured my issue. It might be yours.

Found out that pnpm install --reporter silent --shamefully-hoist vue-cli-plugin-tauri -D actually returned an error code 1. So I ran the command without --reporter silent and got this error:

 ERR_PNPM_PUBLIC_HOIST_PATTERN_DIFF   This module was created using a different public-hoist-pattern value. run "pnpm install" to recreate the modules directory.

Somehow, something had created a node_modules folder in the project. I removed it and ran pnpm install as instructed.
Now I'm getting a different error . But that might belong on a different issue

@bartlian
Copy link

I have met this issue today. I have found the packageManager field value is 'pnpm' in .vuerc file. Then change to 'npm' and it can fix this issue temporarily.

@Jackllllll
Copy link

@bartlian That's useful for me. Thank u so much! Maybe it's PNPM7.1 of i use

@gastrodia
Copy link

I have met this issue today. I have found the packageManager field value is 'pnpm' in .vuerc file. Then change to 'npm' and it can fix this issue temporarily.
thanks

@ToddEmonster
Copy link

Thanks to @Hergeirs', I found this solution :

  1. Delete your node_modules folder
  2. Run vue add tauri

And it worked for me, node_modules is recreated in the process

@Yash-Singh1
Copy link

I am having this problem too, I can't create a new Vue.js App with the pnpm package manager. Strangely, the logs stack trace has a reference to yarn, idk if it's related:

 ERROR  Error: command failed: pnpm install --reporter silent --shamefully-hoist
Error: command failed: pnpm install --reporter silent --shamefully-hoist
    at ChildProcess.<anonymous> (/home/saiansh/.config/yarn/global/node_modules/@vue/cli/lib/util/executeCommand.js:138:16)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

@jay-p-b-7span
Copy link

I am also facing this Issue.

@ayu-exorcist
Copy link

ayu-exorcist commented Jul 26, 2022

  1. cd your_project_path
  2. rm -rf .npmrc && rm -rf node_modules
  3. pnpm install
  4. pnpm add -D yorkie webpack @babel/core @types/node @types/webpack-env

More:

  • if (packageManager === 'pnpm') {
    const pnpmConfig = hasPnpmVersionOrLater('4.0.0')
    ? 'shamefully-hoist=true\n'
    : 'shamefully-flatten=true\n'
    await writeFileTree(context, {
    '.npmrc': pnpmConfig
    })
    }
  • const PACKAGE_MANAGER_PNPM4_CONFIG = {
    install: ['install', '--reporter', 'silent', '--shamefully-hoist'],
    add: ['install', '--reporter', 'silent', '--shamefully-hoist'],
    upgrade: ['update', '--reporter', 'silent'],
    remove: ['uninstall', '--reporter', 'silent']
    }
    const PACKAGE_MANAGER_PNPM3_CONFIG = {
    install: ['install', '--loglevel', 'error', '--shamefully-flatten'],
    add: ['install', '--loglevel', 'error', '--shamefully-flatten'],
    upgrade: ['update', '--loglevel', 'error'],
    remove: ['uninstall', '--loglevel', 'error']
    }

@marty-mcgee
Copy link

marty-mcgee commented Jul 26, 2022

Two alternative quick-fixes (workarounds) not yet mentioned:

  1. use the @vue/cli command OPTION "-m, --packageManager Use specified npm client when installing dependencies"
    -- for example: vue create my-app -m npm or vue create my-app --packageManager yarn
    -- helpful source link: https://v3.cli.vuejs.org/guide/creating-a-project.html#vue-create
  2. run this @vue/cli command to automagically open your .vuerc file: vue config --edit and you can edit entries as necessary.
    -- helpful source link: https://cli.vuejs.org/config/#global-cli-config

@jay-p-b-7span
Copy link

jay-p-b-7span commented Jul 27, 2022

Tried your approach. Still not able to create vue 2 scaffolded project with pnpm. Issue still persists. @ReSpawN @ayu14214

@marty-mcgee
Copy link

Tried your approach. Still not able to create vue 2 scaffolded project with pnpm. Issue still persists. @ReSpawN @ayu14214

Hmmm.. Let me try it in Vue 2. I will hopefully get back to you soon.

@QuentinHsu
Copy link

I am also facing this Issue.

@aleksanderwalczuk
Copy link

+1 faced on both node v14 and 16. Setting npm as dependency manage save the issue.

@IceApriler
Copy link

How to solve this problem?

@aleksanderwalczuk
Copy link

How to solve this problem?

Post more messages and wait for next release 😁

@lclrobert2020
Copy link

Using pnpm v6 solved the issue for me

@lvqq
Copy link
Contributor

lvqq commented Sep 2, 2022

pnpm v7 makes breaking change to set strict-peer-dependencies=true by default. It may interrupt the installing while there exist peer dependencies install errors.

@linghengqian
Copy link

This issue was fixed in #7265 and should be closed.

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