LoginSignup
12
7

More than 5 years have passed since last update.

nodist では、まだ npm@6.0.0 がインストールできない(2018年5月4日からインストールできます)

Last updated at Posted at 2018-04-28

(2018/05/04追記)
npm の Releases ページに v6.0.0 が掲載され、nodist でもインストール可能になりました。


npm って、実行すると、たまにアップデートを促しますよね。

こんな感じの。

   ╭─────────────────────────────────────╮
   │                                     │
   │   Update available 5.6.0 → 6.0.0    │
   │     Run npm i -g npm to update      │
   │                                     │
   ╰─────────────────────────────────────╯

なので、nodist で入れた npm でもアップデートしようと思ったわけです。
こんな感じで。

> nodist npm 6.0.0

そしたら、怒られるわけです。こんな感じ。

npm 6.0.0
Cannot read property 'trim' of null.
Sorry.

いろいろ調べてみたら、nodistGitHub 上の Releases のページを参照していて、このページでリリースされていないバージョンが指定されたら、上のエラーが出るっぽいです。

なので、上のページの最新リリース、6.0.0-next.2 を指定すると、インストールは始まります。怖くて途中でやめましたが。
こんな感じで。

> nodist npm 6.0.0-next.2

なぜ npm は release してないバージョンへのアップデートを促すのか。。。
-> npm は、https://registry.npmjs.org/npm にあるメタデータを見て、判断しています。つまり、npm@6.0.0 は、正式にリリース済みでした。
そして nodist も、6.0.0 is not found くらい言ってくれればいいのに。。。

(追記)
nodist の中のファイル (%NODIST_DIR%\lib\npm.js)を下のように書き換えて、tags からバージョン リストを取得するようにすると入れらないことはないですが、自己責任で。

オリジナル
 47: NPMIST.listAvailable = function(){
 48:   return github.releases.listReleasesAsync({
 49:     owner: 'npm',
     (中略)
184:     var available = results.map(function(v){
185:       return v.tag_name;
186:     });
魔改造
 47: NPMIST.listAvailable = function(){
 48:   return github.repos.getTagsAsync({ user: 'npm',
 49:     owner: 'npm',
     (中略)
184:     var available = results.map(function(v){
185:       return v.name;
186:     });

魔改造後のインストール結果

> npm 6.0.0
https://codeload.github.com/npm/npm/tar.gz/v6.0.0 [============   ] 6815/8351 KiB 82% 7.3s
> npm -v
6.0.0
12
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
7