Next.js Discord

Discord Forum

Help using pnpm

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
Hello,
I am new to Node and Next and have been tinkering with them for a couple of weeks. I have had quite a few things working.

Today I decided to transition from nvm and npm to using pnpm. However I consistently fail at the last step when I run the dev script:

dude@his-machine-Ubuntu:~/aaanasds723/Dev/scratch/hlf$ pnpm dev > hlf@0.1.0 dev /home/dude/his-machine/Dev/scratch/hlf > next dev sh: 1: next: not found  ELIFECYCLE  Command failed.

I have googled and looked through my configuration and am frankly stuck. Is there some basic npm confoiguration that I am missing?

I would greatly appreciate any points or guidance to help solve this issue.

dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ pnpm dev

hlf@0.1.0 dev /home/dude/his-machine/Dev/scratch/hlf
next dev

sh: 1: next: not found
ELIFECYCLE  Command failed.

dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ ls -al
total 20
drwxr-xr-x 2 dude dude 0 May 23 18:26 app
drwxr-xr-x 2 dude dude 0 May 23 22:12 node_modules
-rwxr-xr-x 1 dude dude 281 May 23 22:12 package.json
-rwxr-xr-x 1 dude dude 8566 May 23 22:12 pnpm-lock.yaml

dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ ls -al node_modules/
total 16
-rwxr-xr-x 1 dude dude 2306 May 23 22:12 .modules.yaml
lrwxrwxrwx 1 dude dude 79 May 23 22:11 next -> .pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next
drwxr-xr-x 2 dude dude 0 May 23 22:12 .pnpm
lrwxrwxrwx 1 dude dude 37 May 23 22:12 react -> .pnpm/react@18.3.1/node_modules/react
lrwxrwxrwx 1 dude dude 58 May 23 22:12 react-dom -> .pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom

dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ printenv
PNPM_HOME=/home/dude/.local/share/pnpm
PATH=/home/dude/.local/share/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

23 Replies

@Sun bear Hello, I am new to Node and Next and have been tinkering with them for a couple of weeks. I have had quite a few things working. Today I decided to transition from nvm and npm to using pnpm. However I consistently fail at the last step when I run the dev script: `dude@his-machine-Ubuntu:~/aaanasds723/Dev/scratch/hlf$ pnpm dev > hlf@0.1.0 dev /home/dude/his-machine/Dev/scratch/hlf > next dev sh: 1: next: not found  ELIFECYCLE  Command failed. ` I have googled and looked through my configuration and am frankly stuck. Is there some basic npm confoiguration that I am missing? I would greatly appreciate any points or guidance to help solve this issue. `dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ pnpm dev` > hlf@0.1.0 dev /home/dude/his-machine/Dev/scratch/hlf > next dev `sh: 1: next: not found` ` ELIFECYCLE  Command failed.` `dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ ls -al ` `total 20` `drwxr-xr-x 2 dude dude 0 May 23 18:26 app` `drwxr-xr-x 2 dude dude 0 May 23 22:12 node_modules` `-rwxr-xr-x 1 dude dude 281 May 23 22:12 package.json` `-rwxr-xr-x 1 dude dude 8566 May 23 22:12 pnpm-lock.yaml` `dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ ls -al node_modules/` `total 16` `-rwxr-xr-x 1 dude dude 2306 May 23 22:12 .modules.yaml` `lrwxrwxrwx 1 dude dude 79 May 23 22:11 next -> .pnpm/next@14.2.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next` `drwxr-xr-x 2 dude dude 0 May 23 22:12 .pnpm` `lrwxrwxrwx 1 dude dude 37 May 23 22:12 react -> .pnpm/react@18.3.1/node_modules/react` `lrwxrwxrwx 1 dude dude 58 May 23 22:12 react-dom -> .pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom` `dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ printenv` `PNPM_HOME=/home/dude/.local/share/pnpm` `PATH=/home/dude/.local/share/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin`
try deleting node_modules
and then reinstalling
Sun bearOP
Thanks @!=tgt ! I tried that several times and once more today after seeing your message. But without success.
Hm, weird
try deleting the folder and then running pnpm store prune
Sun bearOP
I created that project following the "manual installation" instructions at: https://nextjs.org/docs/getting-started/installation but using pnpm instead of npm
Then I tried using the automated installation using pnpm create next-app

Same outcome. So I am next going to try what you just suggested...
@!=tgt try deleting the folder and then running `pnpm store prune`
Sun bearOP
By "the folder" do you mean the project or node_modules?
Sun bearOP
Assuming you meant node_modules, I tried again:
1. Delete the node_modules folder
2. Ran pnpm store prune
3. Then re-installed next@latest react@latest react-dom@latest
Still no luck
ok that's weird
Sun bearOP
I am entirely stumped
Guess it is more googling... and posting around....

Do you think it may be am artefact of having used nvm and npm before?
no
Sun bearOP
Hmmm (these stickers are weird :lolsob: )
Sun bearOP
Hey @!=tgt , would you mind running the two commands below and share the results - I am curious to see if my pnpm config is not right.

dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ pnpm config list
registry=https://registry.npmjs.org/
user-agent=pnpm/9.1.2 npm/? node/v18.5.0 linux x64

dude@his-machine-Ubuntu:~/his-machine/Dev/scratch/hlf$ pnpm doctor
*WARN*  Load npm builtin configs failed. If the prefix builtin config does not work, you can use "pnpm config list" to show builtin configs. And then use "pnpm config --global set <key> <value>" to migrate configs from builtin to global.
mine's the exact same
except UA which is mac
Sun bearOP
Thank you @!=tgt !
Sun bearOP
Does anybody know if it is ok to create a project on a SMB-mounted folder while pnpm is installed in the local home folder?
Sun bearOP
Confirmed: it works if I create the project on local file system - it does not work if project is created on a mounted SMB file system.
My guess is it is related to hard- and soft-linking used by pnpm
Sun bearOP
I have struggled with this issue all day without success.

My setup is:
1. My Linux home is on an Ubuntu virtual machine
2. I mount a smb file system
3. All my software development takes place on the smb file system
4. Above works fine with npm
5. Does not work with pnpm (but works if the project folder in my VM's local filesystem)

pnpm is installed in my VM's home directory (~/.local/share/).

So based on reading up all day, I tried two things:
1. Kept pnpm in the VM's home directory but added a store-dir to a npmrc (~/.config/pnpm/rc) --> this did not work
2. Relocated the pnpm home to the top of the SMB mount --> this did not work either

So I am stumped at the moment.

And would appreciate any help!