在Windows上安装mean.io

3
我按照http://learn.mean.io/的步骤进行操作。 我以管理员身份运行cmd。 但是在运行时我遇到了以下错误:
On windows platform - Please check permissions independently
All permissions should be run with the local users permissions
Cloning branch: master into destination folder: myApp2
git clone  --depth 1  -bmaster https://github.com/linnovate/mean.git "myApp2"
FIND: Parameter format not correct
There are 2 files in your ~/.npm owned by root
Please change the permissions by running - chown -R `whoami` ~/.npm
C:\Users\CE\AppData\Roaming\npm\node_modules\mean-cli\lib\utils.js:67
      throw('ROOT PERMISSIONS IN NPM');
      ^
ROOT PERMISSIONS IN NPM
1个回答

7
如果您打开%APPDATA%\npm\node_modules\mean-cli\lib\,您将看到第59行类似于以下内容的代码:
exports.checkNpmPermission = function (callback){
  var homeDir = process.env[isWin ? 'USERPROFILE' : 'HOME'];
  var findCmd = 'find ' + homeDir +'/.npm ' + '-user root';
  shell.exec(findCmd, function( status, output){
    var hasRootFiles = output.split(/\r\n|\r|\n/).length;
    if (hasRootFiles > 1){
      console.log (chalk.red('There are ' + hasRootFiles + ' files in your ~/.npm owned by root'));
      console.log(chalk.green('Please change the permissions by running -'), 'chown -R `whoami` ~/.npm ');
      throw('ROOT PERMISSIONS IN NPM');
    }
  });
  callback();
};

该命令:var findCmd = 'find ' + homeDir +'/.npm ' + '-user root'; 在Windows上无法正常工作。请尝试在您的Windows系统上删除整个shell.exec(...)段落,并再次尝试使用init命令来启动您的mean应用程序。

希望这个问题能够尽快解决。


1
谢谢您指出这一点。很烦人,必须编辑mean-cli源代码才能启动新项目。 - djskinner
1
我创建了一个分支,删除了冒犯性代码。使用:npm install -g git://github.com/djskinner/mean-cli.git - djskinner

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接