【问题标题】:npm install Giving error when Moving Project to Another Directorynpm install 将项目移动到另一个目录时出现错误
【发布时间】:2016-07-08 12:06:57
【问题描述】:

我有一个节点项目在一个目录中运行,我只是想将它移动到另一个目录,比如说。当我尝试这样做时,当然没有 node_modules 文件夹,并尝试运行 npm install;它给出了这个错误:

npm ERR! addLocal Could not install /Users/me_here
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.8.0
npm ERR! npm  v3.7.3

npm ERR! No version provided in package.json

我的 package.json 如下:

{
  "name": "my-amazing-title",
  "version": "1.0.0",
  "description": "an amazing description",
  "main": "app.js",
  "scripts": {
    "start": "node app.js"
  },
  "author": "My full name",
  "license": "MIT",

  "dependencies": {
    "express": "3.3.5",
    "express-react-views": "file:../../",
    "js-md5": "^0.4.0",
    "react": "^0.14.0",
    "react-dom": "^0.14.0",
    "request": "^2.69.0",
    "webpack": "^1.12.14"
  }
}

【问题讨论】:

  • 当你添加 "express-react-views": "file:../../" 时,npm 会在 ../../ 文件夹中寻找一个 package.json 来安装这个依赖.将此文件夹更改为有效的 npm 包文件夹,甚至是原始的 source

标签: node.js error-handling npm package.json npm-install


【解决方案1】:

我可以通过更改这一行来使用你的 package.json 安装 npm:

"express-react-views": "file:../../",

"express-react-views": "~0.10.0", //the current version at date of posting

【讨论】:

  • 或者只是 "express-react-views": "latest",
猜你喜欢
  • 2019-02-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多