全局NPM命令缺失模块:内容同步失败

时间:2016-01-15 11:24:35

标签: json node.js npm contentful

我在全球范围内安装了这样的NPM模块:

sudo npm install -g contentful-space-sync

安装标记警告,但不确定这是否是一个问题:

npm WARN peerDependencies The peer dependency stream-browserify@* included from bl will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
contentful-space-sync@3.0.0 node_modules/contentful-space-sync
├── bluebird@3.1.1
├── yargs@3.31.0 (camelcase@2.0.1, window-size@0.1.4, y18n@3.2.0, decamelize@1.1.2, string-width@1.0.1, os-locale@1.4.0, cliui@3.1.0)
├── npmlog@2.0.0 (ansi@0.3.1, gauge@1.2.4, are-we-there-yet@1.0.5)
├── contentful-batch-libs@2.0.0 (contentful-management@0.7.1, contentful@1.2.1)
└── lodash@3.10.1

安装似乎有效。要运行该模块,最简单的方法是为它创建一个配置文件,我做了:

{
  "sourceSpace": "xxxxxxxx",
  "destinationSpace": "xxxxxxxx",
  "sourceDeliveryToken": "xxxxxxxx",
  "managementToken": "xxxxxxxx"
}

现在我运行这样的模块:

contentful-space-sync --config config.json

但是我收到以下错误:

module.js:339
    throw err;
    ^

Error: Cannot find module 'babel-register'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/contentful-space-sync/index.js:5:5)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/contentful-space-sync/bin/space-sync:4:20)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:134:18)
    at node.js:961:3

对于全球安装的模块,我从来没有这样的东西。为什么不能找到它需要的模块以及如何解决这个问题呢?

1 个答案:

答案 0 :(得分:2)

这是一个糟糕的发布。我们已经意识到这个问题并正在努力解决问题。

目前最好的方法是使用2.1.9。您可以使用npm install -g contentful-space-sync@2.1.9

进行安装