npm install packagename --save-dev不更新package.json [英] npm install packagename --save-dev not updating package.json
问题描述
是否有简单或微妙的原因导致 package.json
在运行--save-dev后不会更新?这是我的命令:
Are there simple or subtle reasons that package.json
would not update after running a --save-dev? This is my command:
npm install modulename --save-dev
从项目的根目录运行。命令成功,新模块按预期显示在node_modules目录中。帮助将不胜感激。我正在使用npm v 1.4.28
Run from the root of the project. The command succeeds, the new module shows up in the node_modules directory as expected. Help would be appreciated. I am using npm v 1.4.28
我当前的 package.json
的全部是:
{
"name": "FooWeb",
"version": "1.0.0",
"description": "Foo Web",
"devDependencies": {
"gulp": "3.8.11",
"gulp-jshint": "1.9.2",
"gulp-concat": "2.5.2",
"gulp-sass": "1.3.3",
"gulp-sourcemaps": "1.4.0",
"gulp-watch": "4.1.1"
}
}
我在安装没有存储库字段或自述文件的软件包时收到警告,但我认为这没有关系。
I do get warnings on install of a package that I have no repository field or README, but I think that is not related.
推荐答案
我也遇到了这个问题,这让我发疯。
I had this problem as well, and it was driving me crazy.
最终解决的问题是运行 npm init
。这给我的package.json添加了很多东西,但是随后-save-dev
可以正常工作。即使我删除了 npm init
添加的所有新内容之后,-save-dev
仍然有效。
What finally fixed it was running npm init
. This added a bunch of stuff to my package.json, but afterwards --save-dev
worked as expected. Even after I removed all the new stuff added by npm init
, --save-dev
still worked.
这篇关于npm install packagename --save-dev不更新package.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!