pnpm i --save foo or pnpm uninstall --save-dev bar
Commands should execute and update package.json accordingly.
An error is returned "unknown option".
node -v prints: v10.16.3It saves automatically. To distinguish between dependencies and devDependencies try to use -D flag: pnpm i -D foo.
@Bessonov if you read #1237 you will see that I strongly argued against defaulting to updating package.json throughout that issue.
@jsumners no, I didn't read it (before), because I never run in any situation in which I don't want to save the information in package.json. I can't judge on your use case, but well, some projects like webpack already use plugins. For me it's more architectural problem and not a dependency manager problem.
This is a real issue for compatibility with npm commands and tools that expect the package manager to be compatible. For example, the npm-check tool supports pnpm by way of:
$ NPM_INSTALLER=pnpm npm-check -u
However, if you you attempt this with pnpm@4 in a project with dependencies that have newer versions available you will get:
$ NPM_INSTALLER=pnpm npm-check -u
? Choose which packages to update. [email protected], [email protected], [email protected]
$ pnpm install --save [email protected] --color=always
Command failed: pnpm install --save [email protected] --color=always
 ERROR  Unknown option 'save'
For more detail, add `--debug` to the command
Ok, for me that are two separate issues/requests. The first one is to change the default behavior to not to save dependencies in package.json. I'm still on the path, that I don't see any reason to not to save them, even the npm has another default. The another one is to provide compatibility with explicit flags, even the flags are no-op. TBH, I didn't know about npm-check, but it can resolve this issue for us, if it works with pnpm monorepos.
It isn’t a noop in npm; npm still supports disabling the auto save feature and has been set so in my settings since the first day they changed the default behavior. The change in pnpm not supporting —save and —save-dev is causing me much grief due to the sudden change and the lack of compatibility that existed prior to 4.
pnpm does support --save and --save-dev (which -D is an alias of), just not for uninstall.

@ExE-Boss you were saying?
Well, ‑‑save is the default, but it should still be able to be specified, but just be a no‑op.
Actually, I may be thinking about ‑‑save‑prod.
‑‑save and ‑‑no‑save is #2020.
Allowing --save will also allow --no-save, which currently has no effect.
How should --save-dev work on uninstall? It should remove the dependency only from dev deps?
How should
--save-devwork on uninstall? It should remove the dependency only from dev deps?
Well, that’s what npm uninstall ‑‑save‑dev does.
How should --save-dev work on uninstall? It should remove the dependency only from dev deps?
@zkochan correct
I'm also seeing the behaviour

@matt3224 That’s currently the intended behaviour.
@ExE-Boss i don't understand this behaviour, how can i avoid it? I tried defining "@neuekit/reboot": "1.9.1" and "@neuekit/reboot": "^1.9.1" both give me that error
I'm using npm-check btw
Could we at least bring back --save as a no-op so it doesn't break scripts?
I'm also voting for a noop --save instead of saying, that it doesn't exist:
Since I most of the time just copy the "npm install
That will be somewhat difficult due to how the pnpm arguments parser works.
I just looked into it because I thought, that might be a quick fix but tbh - I don't understand, what the parser is doing 😂
I added the option to the nopt options and updated the tests, but after modification the registry parameter is somehow no longer recognized (and I don't even get why it works before modification😒).
Maybe this one is a no-brainer for @zkochan who wrote this?🤞
Adding save: Boolean here👇 should do it
pnpm add --save <pkg> is not failing in 4.5.0
Excellent. What about pnpm uninstall --save-dev foo?
That was not done yet. I work on some other features now, so if someone wants to do it, feel free.
Working on the second part
It appears that this functionality (rm --save-dev|--save-optional|--save-prod) was already implemented in the installation engine (and even worked with pnpm -r rm). I just needed to pass through the options.
Excellent.
Thank you for fixing this.
:ship: 4.7.2
Most helpful comment
pnpm add --save <pkg>is not failing in 4.5.0