NPM - 没有许可证字段

时间:2017-09-05 05:28:51

标签: npm

我试图在Visual Studio代码上的集成终端上使用以下命令: npm install

但是,显示错误。它说,“npm WARN package.json AngularJS2@1.0.0没有许可证字段。”我该怎么做才能解决这个问题?

2 个答案:

答案 0 :(得分:1)

Runtime Error Uncaught (in promise): navigation stack needs at least one root page文件中添加许可证属性,例如:

package.json

如果您正在使用OSI批准的许可证开源软件包,请使用this list中的标识符作为{ "name": .... "license" : "SEE LICENSE IN <filename>" } 属性的值。

以下是package.json格式的规范:https://docs.npmjs.com/files/package.json

答案 1 :(得分:0)

添加到您的package.json:

function generateKeywords($str)
        {
            $min_word_length = 3;
            $avoid = ['the','to','i','am','is','are','he','she','a','an','and','here','there','can','could','were','has','have','had','been','welcome','of','home','&nbsp;','&ldquo;','words','into','this','there'];
            $strip_arr = ["," ,"." ,";" ,":", "\"", "'", "“","”","(",")", "!","?"];
            $str_clean = str_replace( $strip_arr, "", $str);
            $str_arr = explode(' ', $str_clean);
            $clean_arr = [];
            foreach($str_arr as $word)
            {
                if(strlen($word) > $min_word_length)
                {
                    $word = strtolower($word);
                    if(!in_array($word, $avoid)) {
                        $clean_arr[] = $word;
                    }
                }
            }
            return implode(',', $clean_arr);
        }

如果您的软件是开源的,则可以在以下示例上使用相同的示例: https://opensource.org/licenses