【问题标题】:NPM Error: Cannot find module 'are-we-there-yet'NPM 错误:找不到模块'are-we-there-yet'
【发布时间】:2015-12-27 20:05:41
【问题描述】:

我们使用 Codeship 进行持续集成,使用 Modulus 来托管我们的项目。代码在上周之前一直正常运行,现在我收到以下错误。

    → modulus deploy -p 'project_name'
Welcome to Modulus
You are logged in as user_name
Selecting project_name

Compressing project...
5.7 MB written
Uploading project...
Upload progress [===================] 100%
Deploying Project...
Starting build.
Creating directories for build environment.
Downloading source.
Executing build.
Package found: /package.json
Installing node 0.10.25
Installing npm 3.3.4
Installing packages from /package.json

module.js:340
    throw err;
          ^
Error: Cannot find module 'are-we-there-yet'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/mnt/home/.nvm/v0.10.25/lib/node_modules/npm/node_modules/npmlog/log.js:2:16)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
npm install failed, trying again

这是 package.json 文件

{
  "name": "project-name",
  "version": "0.0.1-77",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "engines": {
    "node": "0.10.25",
    "npm": "2.x.x"
  },
  "author": "author_name",
  "license": "ISC",
  "dependencies": {
    "express": "3.5.1",
    "underscore": "^1.6.0",
    "handlebars": "^3.0.3",
    "rendr": "1.0.3",
    "rendr-handlebars": "0.2.0",
    "request": "~2.30.0",
    "config": "^0.4.35"
  },
  "devDependencies": {
    "grunt": "^0.4.4",
    "grunt-browserify": "^1.2.12",
    "grunt-contrib-concat": "^0.5.0",
    "grunt-contrib-handlebars": "^0.8.0",
    "grunt-contrib-less": "^0.11.0",
    "grunt-contrib-watch": "^0.6.1",
    "nodemon": "^1.0.17"
  }
}

注意-该项目在一周前运行良好。现在我正面临这个问题。

【问题讨论】:

  • @Claies 一周前还在工作。完全相同的代码,在本地机器上工作。
  • 好的,但是您是否尝试过另一个问题的答案?它基本上说 NPM 本身存在一个丢失的文件,这可能由于多种原因而发生,而且它在一周前工作的事实与 现在 丢失的文件无关。跨度>
  • @Claies 在发布问题之前我已经尝试过该解决方案!
  • 好吧,如果您 完全重新安装 NPM,正如另一个问题的答案所述,那么如果您的操作系统仍在抱怨核心模块NPM 不可用。

标签: javascript node.js codeship modulus.io


【解决方案1】:

这仍然是 Modulus 上的一个活跃问题。我从一些艰苦的课程中发现,你肯定需要确保你对组件版本做出有意识的决定。从 node 和 npm 版本一直到 package.json 中的内容。如果您指定最新版本,您将在最不希望出现的时候出现错误。

示例。在 package.json 中:

"engines": {
"node": "0.10.18",
"npm": "1.3.8"
},

如果需要,我还建议定期有选择地升级组件。

【讨论】:

    【解决方案2】:

    我在使用模数.io 时遇到了同样的问题。上周工作。今天失败了。我通过在 packages.json 中明确指定 npm 版本来修复它。

    "engines": {
      "node": "0.10.22",
      "npm": "1.3.14"
    }
    

    我认为在您的情况下2.x.x 无效,因为日志输出显示模数仍然使用3.3.4

    --乔纳森

    【讨论】:

      猜你喜欢
      • 2020-07-13
      • 2015-12-22
      • 2015-12-20
      • 2015-09-10
      • 1970-01-01
      • 2014-12-29
      • 1970-01-01
      • 1970-01-01
      • 2017-01-17
      相关资源
      最近更新 更多