安装 ember-cli-coffeescript 时无法读取未定义的 属性 'then'

Cannot read property 'then' of undefined when installing ember-cli-coffeescript

安装 ember-cli 后,我想安装 coffeescript 插件使用:

ember install ember-cli-coffeescript

如文档中所示,但出现错误:

WARNING: Skipping npm install: package.json not found
package.json not found
Cannot read property 'then' of undefined
TypeError: Cannot read property 'then' of undefined
   at Class.run (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/lib/tasks/addon-install.js:43:7)
at Class.run (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/lib/commands/install.js:39:25)
at Class.<anonymous> (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/lib/models/command.js:241:20)
at initializePromise (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:588:5)
at PromiseExt.Promise (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1076:31)
at new PromiseExt (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/lib/ext/promise.js:32:8)
at Class.validateAndRun (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/lib/models/command.js:195:12)
at /home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/lib/cli/cli.js:130:22
at tryCatch (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:538:12)
at invokeCallback (/home/daniel/.nvm/versions/node/v7.6.0/lib/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:553:13)

我不明白这是什么意思。我在 Angular.js 的不同上下文中看到过这个问题,但这些问题与人们的代码有关。这个问题与安装本身有关。这是一个全新的项目并安装。

有什么想法吗?

您是否尝试过添加 package.json 文件? 运行 npm init

轻松完成

package.json file usually in the project root, called package.json - this file holds various metadata relevant to the project. This file is used to give information to npm that allows it to identify the project as well as handle the project's dependencies.

确保您有一个正确的初始化 Ember 项目。如果您没有 package.json 文件。尝试使用项目文件夹中的 Ember init 重新初始化项目。

注意:init进程可能会覆盖项目中已有的文件。重要的话备份一下。