node_module>——save不更新依赖项

npm install <node_module> --save not updating dependencies

本文关键字:save 依赖 更新 module node      更新时间:2023-09-26
    <=== To anyone experiencing the same issue reinstalling the computer works ===>

我不得不重新安装我的电脑,不得不重新安装Node和NPM,却不知道哪里出了问题,这让我发疯了。

我在Windows 10 64位计算机上,我运行npm init,它工作得很好。我可以安装依赖关系没有麻烦,本地和全局,但使用npm install <node_module> --save不会更新我的package.json文件与依赖关系。

我重新安装了npm和node,没有变化。
我试过以管理员身份运行cmd,没有。
我也重新启动了电脑,还是没有。

如果有人知道如何解决这个问题,请帮助。我绝望了!

更新#1:当安装一些模块时,我看到他们在我的项目文件夹中创建。cmd文件,如果这是一个线索,以前没有经历过

更新# 2:刚刚使用npm init创建了一个新的安装,然后尝试了npm install express --save,这就是软件包。json文件:

  {  
    "name": "test",  
    "version": "1.0.0",  
    "description": "",  
    "main": "index.js",  
    "scripts": {  
      "test": "echo '"Error: no test specified'" && exit 1"  
    },  
    "keywords": [],  
    "author": "",  
    "license": "ISC"  
  }

我通过完全清除和重新安装我的计算机来修复这个问题。我不知道是否还有其他解决办法,但这是一个解决办法……

只是一个建议,您可以尝试在命令前添加"sudo"