npm v5.0.0 正式發布,改進了穩定性 - OSCHINA - 中文開源技術交流...

2020-12-11 開源中國

npm 5 有了很大的進步,在幾乎所有常見的情況下顯著地改進了其性能,修復了很多由架構導致的舊的錯誤,使其更穩定和具有更好的容錯性。這對於需要一致性/安全保證的用戶是個好消息,新版還為 git 依賴提供了語義化支持。

重大變更:

  • 現有的 npm 緩存將不再使用:您將不得不重新下載全部緩存的軟體包。沒有任何工具或意圖重新使用舊的緩存 (#15666)

  • 不要再使用大寫的 npm(npm will now scold you if you capitalize its name. seriously it will fight you.)

  • npm will --save by default now。另外,除非 npm-shrinkwrap.json 存在,否則package-lock.json 將會自動創建 (#15666)

  • 通過 user/repo#semver:^1.2.3,Git 依賴支持語義化 (#15308) (#15666) (@sankethkatta)

  • 移除 Stub 文件 (#16204) (@watilde)

  • 「extremely legacy」 _token couchToken 已被移除 (#12986)

  • npm install ./packages/subdir will now create a symlink instead of a regular installation. file://path/to/tarball.tgz will not change – only directories are symlinked. (#15900)

  • Git dependencies with prepare scripts will have their devDependencies installed, and npm install run in their directory before being packed.

  • npm cache commands have been rewritten and don’t really work anything like they did before. (#15666)

  • --cache-min and --cache-max have been deprecated. (#15666)

  • Running npm while offline will no longer insist on retrying network requests. npm will now immediately fall back to cache if possible, or fail. (#15666)

  • package locks no longer exclude optionalDependencies that failed to build. This means package-lock.json and npm-shrinkwrap.json should now be cross-platform. (#15900)

  • If you generated your package lock against registry A, and you switch to registry B, npm will now try to install the packages from registry B, instead of A. If you want to use different registries for different packages, use scope-specific registries (npm config set @myscope:registry=https://myownregist.ry/packages/). Different registries for different unscoped packages are not supported anymore.

  • Shrinkwrap and package-lock no longer warn and exit without saving the lockfile.

  • Local tarballs can now only be installed if they have a file extensions .tar.tar.gz, or .tgz.

  • A new loglevel, notice, has been added and set as default.

  • One binary to rule them all: ./cli.js has been removed in favor of ./bin/npm-cli.js. In case you were doing something with ./cli.js itself. (#12096) (@watilde)

詳情請參閱發布主頁。

>>>【全民狂歡,評論有禮】5月15日-31日評論每日更新的「新聞資訊和軟體更新資訊」,評論點讚數超過 20 的可登上每周更新的「源資訊」和「軟體周刊」兩大欄目,點讚數超過 50 的還將獲得 5 活躍積分獎勵和開源中國定製好禮。詳情

相關焦點