Reputation: 91949
I am facing the issue in running this command
npm pkg set name=foo3
Unknown command: "pkg"
To see a list of supported npm commands, run:
npm help
The documentation says that it is available in 7.x
release, yet it fails when I run it
My npm
version is
➜ foo3 git:(master) npm -v
7.17.0
What am I missing?
Thank you
Upvotes: 0
Views: 2940
Reputation: 91949
To make sure it works for all users, this is what I am doing right now
npx -y npm@latest pkg set name=${repoName}
Upvotes: 0
Reputation: 389
7.20.3 (latest as of this post) has pkg
available
$ npm --version
7.20.3
$ npm pkg set name=testpkg
$ cat package.json
{
"name": "testpkg",
...
npm i -g npm
To update to latest.
Upvotes: 2
Reputation: 2670
I just tried and it worked
flakerimi$ npm pkg set name=foo3
flakerimi$ npm pkg get
{
"name": "foo3",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Maybe it has to do with your version of NPM or npm installation, Can you reinstall it, try from stable source.
Upvotes: 0