2015-04-01 40 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