【发布时间】:2016-08-01 02:55:32
【问题描述】:
我正在尝试将图像从 EmberJS 应用程序 (v2.6) 上传到 cloudinary,遵循使用 post of Beerlington 的 cloudinary_js(现在使用新的 API v2)并安装它:
npm install blueimp-file-upload --save
npm install cloudinary-jquery-file-upload --save
但是当我尝试初始化 cloudinary 时,无法识别该库。
#app/initializers/cloudinary.js
export default {
name: 'cloudinary',
initialize: function(/* container, app */) {
jQuery.cloudinary.config({
cloud_name: ENV.CLOUDINARY_NAME
});
}
};
#console
TypeError: Cannot read property 'config' of undefined
【问题讨论】:
-
ember-cli-build.js - app.import(
.js>.... 包含所有必需的文件。 -
当我使用 npm 安装库时,它们位于 npm_modules/ 中,当我尝试将其导入 ember-cli-build.js 时,它会抱怨。它适用于 vendor/ 和 bower_components/
-
我也尝试使用 ember-browserify 但它也不适用于 cloudinary-jquery-file-upload :(
-
这将对您有所帮助 - stackoverflow.com/questions/26544578/… - 您是否有任何具体理由只使用 npm 包。
-
因为在我使用 npm 安装的 'cloudinary-jquery-file-upload.js' 文件中,我找到了方法 'unsigned_cloudinary_upload' 但在 Bower 获取的 js 文件中我找不到方法。我已经尝试使用 ember-browserify 失败了。
标签: ember.js npm ember-cli cloudinary