Json file, set the main field

  • The value of this field is the ID of the main entry module of your program. If another user needs your package, it returns the module’s exports when the user calls require() or import.

Npmignore file

  • Write the ignored files here, because by default, NPM packaging is based on.gitignoreTo ignore the file if found present.npmignoreIf so, use this file
  • No need to publish toNPM files and folders, rules and.gitignoreThe same. If you have.gitignore at the bottom of your project and it doesn’t.npmignoreThe configuration in.gitignore will be used
  • Links: juejin. Cn/post / 698840…
  • Links: juejin. Cn/post / 684490…

First you have to have an NPM account. Sign up for one

  • NPM address: www.npmjs.com/
  • After registration, please remember to activate the email and verify the email address.

Once you have an NPM account, you can do the following (directly on the command line in vscode).

  • npm login

This error is reported because I am currently setting CNPM and logging in to CNPM, so I need to switch back

  • NPM config get registry it prints the CNPM Taobao sourcehttps://registry.npm.taobao.org/So we need to cut backNPMJS source

After switching back to the NPMJS source, continue with NPM login

  • npm login

Error message NPM notice the Log in on http://registry.npmjs.org/ NPM notice Beginning October 4, 2021, All Connections to the NPM Registry - including for Package Installation - must use TLS 1.2 or highEmail: (this IS public) [email protected] npm notice Beginning October 4, 2021, All connections to the NPM registry - including for package installation - must use TLS 1.2 or higher. You are currently housed  using plaintext http to connect. Please visit the GitHub blog for more information: https://g1.2 or highithub.blog/2021-08-23-npm-registry- Deprecating - TLS-1-0-TLS-1-1 / Y-deprecati NPM Notice Beginning October 4, 2021, All Connections to the NPM registry - including for package installation - must use TLS 1.2 or high 1.2 or higher are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://gy-deprecatiithub.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/ npm ERR! code E426 npm ERR! 426 Upgrade Required - PUT http://registry.npmjs.org/-/user/org.couchdb.user:karso.he npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\waxxxxx.he\AppData\Local\npm-cache\_logs\2021-11-16T03_59_23_302Z-debug.logCopy the code
  • Cause of the problem:Warning about TLS 1.2 appears with Node v16.3.0 and npm v7.21.0
  • Link: github.com/npm/tls-tes…
  • I’ll create it in the root directory.npmrcFile, addregistry=https://registry.npmjs.org
  • check.npmrcFile to change the registry key tohttpsAfter, it can work without reporting this error

Publish NPM publish NPM login publish NPM publish

  • NPM login :(need to enter account, password, email)
  • After success, type: NPM publish

NPM publish error

  • npm publish

# NPM publish at 403 error: 403 Forbidden - PUT https://registry.npmjs.org/ocean_test_npm - who goes byCopy the code
  • Cause: An error occurs when the first package is published immediately after the NPM account is registered. Because after the account is registered, it is not in the registered mailboxVerify email addressFind it in the mailboxNpmTo send an email to the official website, clickVerify email address

After the package is successfully sent, remember to reset NPM back to CNPM (if you like).

  • npm publishContract awarding successful

  • Switch back to: Taobao mirror juejin.cn/post/700694…

Remember to change the content every time, before sending the package, remember to change the version number, otherwise it will report an error!!

Woca, I sent NPM is the source code. I wanted to send the build. js file, but I found that import could not be found after install, and it was still in debug

conclusion

React QQ group:788023830 —- React/Redux - Old underground hero

Front-end COMMUNICATION QQ group:249620372 —- FRONT - END - JS FRONT END

(Our mission is, for overtime, for baldness… , look up to the big guy), I hope friends to study together