Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change a Package.Json Name

Tags:

json

node.js

In this package.json file

{
  "name": "Orignal Name",
  "version": "0.0.1",
  "description": "An App",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "engines": {
    "node": "0.10.x",
    "npm": "1.3.x"
  },
  "author": "An author",
  "license": "BSD-2-Clause",
  "dependencies": {
    "jade": "~0.35.0",
    "express": "~3.4.4",
    "stylus": "~0.40.2",
    "mongoose": "~3.8.0",
    "passport-local": "~0.1.6",
    "passport": "~0.1.17"
  },
  "devDependencies": {
    "karma-mocha": "~0.1.0",
    "mocha": "~1.14.0",
    "karma-chai-plugins": "~0.1.3",
    "karma-firefox-launcher": "~0.1.0",
    "karma-chrome-launcher": "~0.1.0",
    "karma-script-launcher": "~0.1.0",
    "karma-html2js-preprocessor": "~0.1.0",
    "karma-jasmine": "~0.1.3",
    "requirejs": "~2.1.9",
    "karma-requirejs": "~0.2.0",
    "karma-coffee-preprocessor": "~0.1.0",
    "karma-phantomjs-launcher": "~0.1.0",
    "karma": "~0.10.5"
  }
}

How Do I change the "name": attribute "Original Name" to "New Name" without breaking npm install.

I tried simply updating the name and attempting npm install but npm install won't read the package.json file now.

Thanks in advance

like image 226
Chase Nelson Avatar asked Sep 25 '14 13:09

Chase Nelson


People also ask

Can you manually edit package json?

You can add dependencies to a package. json file from the command line or by manually editing the package. json file.

What should I name a package JSON file?

A package. json file must contain "name" and "version" fields. The "name" field contains your package's name, and must be lowercase and one word, and may contain hyphens and underscores. The "version" field must be in the form x.x.x and follow the semantic versioning guidelines.

Does package json name matter?

If you plan to publish your package, the most important things in your package. json are the name and version fields as they will be required. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version.


1 Answers

just edit the name in package.json. The name must following the rules https://docs.npmjs.com/files/package.json#name

like image 116
Henrique Jensen Avatar answered Nov 15 '22 04:11

Henrique Jensen