2020년 9월에 NPM(Yarn 또는 PNPM이 아님)을 사용하시겠습니까?

AFAIK, NPM은 scripts.preinstallengineStrict와 같은 몇 가지 심각한 불일치를 수정하지 않았습니다.

{
  "scripts": {
    "preinstall": "echo 'going to install'"
  },
  "engines": {
    "node": "12.x",
    "yarn": "please-use-pnpm",
    "npm": "please-use-yarn",
    "pnpm": "please-use-yarn"
  },
  "engineStrict": true
}

engineStrict 에 대해 수정은 echo 'engine-strict=true' > .npmrc 만큼 쉽지만 GitHub에 커밋.npmrc하면 GitGuardian 오류가 발생합니다.

preinstall에 관해서는 첫 설치에 거의 완벽하지만...

PNPM



PNPM은 또 다른 큰 주제입니다. 많은 모듈이 symlinks , 심지어 echo 'shamefully-hoist=true' > .npmrc 와도 잘 작동하지 않습니다.

최근에는 PNPM 및 @vue/cli 에 성가신 오류가 하나 있습니다.

 DONE  Compiled successfully in 24962ms                                                                                                1:43:39 AM

ERROR in /Users/patarapolw/projects/wk-extra-web/packages/web/src/app/index.ts(38,14):
38:14 Property '$store' does not exist on type 'App'.
    36 |         alert(e)
    37 |       } else {
  > 38 |         this.$store.commit('SET_API_KEY', this.loginKey)
       |              ^
    39 |       }
    40 |     }
    41 |   }
Version: typescript 3.9.7
Time: 3420ms

  App running at:
  - Local:   http://localhost:8080/ 
  - Network: http://192.168.1.3:8080/

  Note that the development build is not optimized.
  To create a production build, run pnpm run build.


그리고 로컬 생성*.d.ts은 도움이 되지 않습니다. 그러나 Yarn으로 변경하면 도움이 됩니다.



또한 Yarn 버전 2, which still should only be enabled on per project basis 이 있음을 알 수 있습니다.

하지만 Vue CLI와 함께 사용할 수 없습니다 ...

-------------------------------------------------------------------------------------------------------------------------------------------------
~/projects/wk-extra-web/packages/web(website*) » yarn set version berry                                 130 ↵ patarapolw@Pacharapols-MacBook-Air
Resolving berry to a url...
Downloading https://github.com/yarnpkg/berry/raw/master/packages/berry-cli/bin/berry.js...
Saving it into /Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs...
Updating /Users/patarapolw/projects/wk-extra-web/packages/web/.yarnrc.yml...
Done!
-------------------------------------------------------------------------------------------------------------------------------------------------
~/projects/wk-extra-web/packages/web(website*) » yarn                                                         patarapolw@Pacharapols-MacBook-Air
➤ YN0065: Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry
➤ YN0065: Run yarn config set --home enableTelemetry 0 to disable

➤ YN0000: ┌ Resolution step
➤ YN0001: │ HTTPError: fork-ts-checker-webpack-plugin-v5@npm:5.1.0: Response code 404 (Not Found)
    at o.<anonymous> (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:23:12912)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
➤ YN0000: └ Completed in 9.36s
➤ YN0000: Failed with errors in 9.36s
-------------------------------------------------------------------------------------------------------------------------------------------------
~/projects/wk-extra-web/packages/web(website*) » yarn dev                                                 1 ↵ patarapolw@Pacharapols-MacBook-Air
Internal Error: @wk-extra/web@workspace:.: This package doesn't seem to be present in your lockfile; try to make an install to update your resolutions
    at H.getCandidates (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:2:298255)
    at i.getCandidates (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:2:287498)
    at /Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:2:308721
    at Array.map (<anonymous>)
    at ie.resolveEverything (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:2:308437)
    at async ie.applyLightResolution (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:2:330958)
    at async ie.restoreInstallState (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:2:330688)
    at async Re.execute (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:2:87214)
    at async Re.validateAndExecute (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:2:559450)
    at async j.run (/Users/patarapolw/projects/wk-extra-web/packages/web/.yarn/releases/yarn-berry.cjs:17:19046)


그래도 현재로서는 Yarn이 최고라고 생각합니다. 기능과 속도뿐만 아니라 공식 지원도 있습니다.

좋은 웹페이지 즐겨찾기