Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Npm (对象分配)Babel 5插件正在与Babel 6一起运行_Npm_Browserify_Babeljs_Babel 6 - Fatal编程技术网

Npm (对象分配)Babel 5插件正在与Babel 6一起运行

Npm (对象分配)Babel 5插件正在与Babel 6一起运行,npm,browserify,babeljs,babel-6,Npm,Browserify,Babeljs,Babel 6,更新项目依赖项后,我开始看到这个错误,objectassignbabel5插件似乎存在版本控制问题 更新后我使用了Babel 6,我能找到的最接近的插件是es6 object assign,但是使用它会导致错误(错误如下所示) 在我的应用程序中使用browserify+babelify+对象分配: var babelify = require('babelify'); var browserify = require('browserify-middleware'); var keystone

更新项目依赖项后,我开始看到这个错误,
objectassign
babel5插件似乎存在版本控制问题

更新后我使用了Babel 6,我能找到的最接近的插件是
es6 object assign
,但是使用它会导致错误(错误如下所示)

在我的应用程序中使用
browserify
+
babelify
+
对象分配

var babelify = require('babelify');
var browserify = require('browserify-middleware');
var keystone = require('keystone');

var importRoutes = keystone.importer(__dirname);

// Setup Route Bindings
exports = module.exports = function(app) {
    app.use('/js', browserify('./client/scripts', {
        transform: [babelify.configure({
            plugins: ['object-assign']
        })]
    }));
    // Views
    app.use(function(req, res) {
        res.render('index');
    });
};
服务器日志:

GET / 304 260.457 ms
Error thrown for request: /js/Application.js
Error: The (object-assign) Babel 5 plugin is being run with Babel 6. while parsing file: /home/user/project/client/scripts/Application.js
    at new Plugin (/home/user/project/node_modules/babel-core/lib/api/node.js:96:9)
    at exports.default (/home/user/project/node_modules/babel-plugin-object-assign/lib/index.js:11:10)
    at Function.memoisePluginContainer (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:109:13)
    at Function.normalisePlugin (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:142:32)
    at /home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:30
    at Array.map (native)
    at Function.normalisePlugins (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:154:20)
    at OptionManager.mergeOptions (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:36)
    at OptionManager.init (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
    at File.initOptions (/home/user/project/node_modules/babel-core/lib/transformation/file/index.js:216:65)
    at new File (/home/user/project/node_modules/babel-core/lib/transformation/file/index.js:139:24)
    at Pipeline.transform (/home/user/project/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at Babelify._flush (/home/user/project/node_modules/babelify/index.js:27:24)
    at Babelify.<anonymous> (_stream_transform.js:118:12)
    at Babelify.g (events.js:291:16)
    at emitNone (events.js:86:13)

babelify
中的
index.js
将分配定义为
var assign=require(“对象分配”)而不是
对象。分配(a,b)
babel插件转换对象分配
未检测到此模式,也未替换任何内容。(如本文所述,
babelify
中的
index.js
将分配定义为
var assign=require(“对象分配”)而不是
对象。分配(a,b)
babel插件转换对象分配
未检测到此模式,也未替换任何内容。(如本文所述)
GET / 304 280.365 ms
Error thrown for request: /js/Application.js
Error: Plugin 0 specified in "base" provided an invalid property of "assign" while parsing file: /home/user/project/client/scripts/Application.js
    at Plugin.init (/home/user/project/node_modules/babel-core/lib/transformation/plugin.js:131:13)
    at Function.normalisePlugin (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:148:12)
    at /home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:30
    at Array.map (native)
    at Function.normalisePlugins (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:154:20)
    at OptionManager.mergeOptions (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:36)
    at OptionManager.init (/home/user/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
    at File.initOptions (/home/user/project/node_modules/babel-core/lib/transformation/file/index.js:216:65)
    at new File (/home/user/project/node_modules/babel-core/lib/transformation/file/index.js:139:24)
    at Pipeline.transform (/home/user/project/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at Babelify._flush (/home/user/project/node_modules/babelify/index.js:27:24)
    at Babelify.<anonymous> (_stream_transform.js:118:12)
    at Babelify.g (events.js:291:16)
    at emitNone (events.js:86:13)
    at Babelify.emit (events.js:185:7)
    at prefinish (_stream_writable.js:478:12)