【问题标题】:mean.io installation on windows在 Windows 上安装 mean.io
【发布时间】:2015-04-02 19:33:56
【问题描述】:

我按照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

【问题讨论】:

    标签: node.js mean.io


    【解决方案1】:

    如果您打开%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 上不起作用。尝试删除整个 shell.exec(...) 段以在您的 Windows 机器上解决问题,然后再次尝试 init 您的平均应用程序。

    希望这将很快得到解决。

    【讨论】:

    • 感谢您指出这一点。为了开始一个新项目而不得不编辑 mean-cli 源代码很烦人。
    • 我创建了一个分叉来删除攻击性代码。使用:npm install -g git://github.com/djskinner/mean-cli.git
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-28
    • 1970-01-01
    • 2011-06-10
    • 2014-06-26
    • 2016-06-05
    • 2013-12-25
    • 2018-06-16
    相关资源
    最近更新 更多