2015-04-01 94 views
3

我按照http://learn.mean.io/中指定的步骤进行操作。 我运行cmd作为adiminstrator。 但我发现了以下错误上运行,但得到以下错误:windows上的mean.io安装

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 

回答

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';不会在窗户上工作。尝试删除整个shell.exec(...)段以解决您的Windows机器上的问题,然后再尝试init您的平均应用程序。

希望这个问题很快就会解决。

+1

感谢您指出这一点。令人讨厌的是为了开始一个新项目而必须编辑平均资源来源。 – djskinner 2015-04-03 20:14:06

+1

我创建了一个删除令人反感的代码的分支。使用:'npm install -g git:// github.com/djskinner/mean-cli.git' – djskinner 2015-04-03 20:21:18

+0

that worked ...谢谢 – 2015-04-06 05:55:05