如何更改Package.Json名称

时间:2014-09-25 13:16:19

标签: json node.js

在这个package.json文件中

{
  "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"
  }
}

如何更改"名称":属性"原始名称"到"新名称"没有破坏npm安装。

我尝试只是更新名称并尝试npm install,但是npm install现在不会读取package.json文件。

提前致谢

1 个答案:

答案 0 :(得分:5)

只需在package.json中编辑名称即可。 该名称必须遵循规则https://docs.npmjs.com/files/package.json#name