安装 MobileFirst Platform mfpdev-cli 的节点错误

Node error to install MobileFirst Platform mfpdev-cli

您好,我安装mfpdev-cli时出错。

我 运行 在节点中:

npm install -g mfpdev-cli

此外,我试过:

npm install -g --no-optional mfpdev-cli

我得到了相同的结果:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "..\AppData\Roaming\npm\node_modules\mdo-adapter-actions" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     ..\AppData\Roaming\npm-cache\_logs17-10-06T19_33_40_852Z-debug.log

日志文件:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli   'C:\Users\admin\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'mfpdev-cli' ]
2 info using npm@5.4.2
3 info using node@v8.6.0
4 verbose npm-session c592940cb4bd8510
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/mfpdev-cli 17ms (from cache)
8 silly pacote tag manifest for mfpdev-cli@latest fetched in 57ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 silly install loadShrinkwrap
12 silly install loadAllDepsIntoIdealTree
13 silly resolveWithNewModule mfpdev-cli@8.0.2017092810 checking installable status
14 silly pacote trying https://registry.npmjs.org/mfpdev-cli/-/mfpdev-cli-8.0.2017092810.tgz by hash: sha1-xVC4PO9ZSewF6xzlXsWExVTqvsw=
15 silly pacote https://registry.npmjs.org/mfpdev-cli/-/mfpdev-cli-8.0.2017092810.tgz extracted to C:\Users\ADMIN\AppData\Local\Temp\npm-11192-a75b2045\unpack-1eeac08f by content address 11899ms
16 silly addBundled read tarball
17 silly cleanup remove extracted module
18 silly fetchPackageMetaData error for mdo-adapter-actions@file:..\mdo-adapter-actions Could not install from "C:\Users\admin\AppData\Roaming\npm\node_modules\mdo-adapter-actions" as it does not contain a package.json file.
19 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\admin\AppData\Roaming\npm\node_modules\mdo-adapter-actions\package.json'
20 verbose cwd H:\
21 verbose Windows_NT 10.0.15063
22 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\admin\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "mfpdev-cli"
23 verbose node v8.6.0
24 verbose npm  v5.4.2
25 error code ENOLOCAL
26 error Could not install from "C:\Users\admin\AppData\Roaming\npm\node_modules\mdo-adapter-actions" as it does not contain a package.json file.
27 verbose exit [ 1, true ]

我的Node版本是8.6.0,NPM版本是5.4.2,OS是Windows10.

我试过降级版本和清理缓存,但一直都是同样的错误。

如何安装 IMB MobileFirst Platform CLI?

这个问题只发生在最新版本的 mfpdev-cli v8.0.2017090705 我尝试了来自 Whosebug 的不同解决方案,但它们对我不起作用。

你应该试试这个:

npm cache clean
npm set registry https://registry.npmjs.org/
npm set registry http://registry.npmjs.org/

npm install -g mfpdev-cli@latest

他们似乎注意到了这些错误,因为 mfpdev-cli 的代码是在 5 小时前更新的 (https://www.npmjs.com/package/mfpdev-cli)。

我昨天遇到了同样的错误(即使在将 npm 降级到 3.10.10 和更低版本以及在 Windows 10 和 Mac Sierra 上)并且它仍然在两个 OS 但它终于开始工作了 (mfpdev -v 8.0.0-2017101013)。

  • 使用 Node -v 6.9.3 安装在 Windows 10 上; npm 3.10.10.
  • 使用 Node -v 6.11.4 安装在 Mac Sierra 上; npm 3.10.10.

编辑:

我在 OS 中将 npm 更新到最新版本 (5.5.1),但安装仍然失败,因此需要降级到 3.10.10(如 Gaurab Kumar 的回答所述)。