国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

npm pnpm yarn 報錯或常見問題處理集錦

這篇具有很好參考價值的文章主要介紹了npm pnpm yarn 報錯或常見問題處理集錦。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

各種卡死,報錯問題處理匯總

1. npm 安裝 卡死了怎么辦,npm

# 切換源
npm config set registry https://registry.npmmirror.com
# 查看源
npm config get registry

2. pnpm安裝 卡死了怎么辦

方法1:切換源
npx pnpm config set registry https://registry.npmmirror.com

npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js

方法2:清除緩存
pnpm cache clean --force

3. npm install node-sass卡死不動, 切換源

解決方案1

node-sass 從 淘寶源下載

npm config set sass-binary-site https://npm.taobao.org/mirrors/node-sass

4. yarn install 卡死不動

解決方案1

將 yarn 源切換至淘寶源

yarn config set registry https://registry.npm.taobao.org

5. yarn install node-sass卡死不動

解決方案1

node-sass 從 淘寶源下載

yarn config set sass-binary-site https://npm.taobao.org/mirrors/node-sass

6. yarn install 遇到報錯:info There appears to be trouble with your network connection. Retrying…

[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.npmjs.org/echarts/-/echarts-4.9.0.tgz: connect ETIMEDOUT 104.16.1.35:443".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Jindi J Sun\\Documents\\jin_files\\A_Backend_Project\\TRF\\TRF\\UI\\yarn-error.log".
解決方案1

除 yarn.lock 文件,重新執(zhí)行

yarn install

7. yarn install 遇到報錯:error commander@11.1.0: The engine “node” is incompatible with this module. Expected version “>=16”. Got “14.16.1” error Found incompatible module. info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js

解決方案1
 yarn config set ignore-engines true 

刪除之前node-mdules ,重新執(zhí)行

yarn install

npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js
npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js

8. 報錯This dependency was not found,To install it, you can run: npm install --save vxe-table/lib/vxe-table

npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js

This dependency was not found:
- vxe-table/lib/vxe-table in ./src/plugins/vxetable.ts
To install it, you can run: npm install --save vxe-table/lib/vxe-table
解決方案:

查訪此issue后得知:

  • 把package.json里babel-plugin-import版本前的 ^ 符號刪掉
  • 刪除node-modules包
  • 刪除lock文件
  • 重新下載依賴
    npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js

9. npm ERR! Maximum call stack size exceeded報錯

解決方案如下:

1.更新npm版本

// 查看版本
npm -v
// 更新
npm install -g npm

2.刪除node_module和package-lock.json

3.重新執(zhí)行npm install

4.如果還不行,執(zhí)行下面命令

npm cache clean --force

5.繼續(xù)執(zhí)行npm install

6.完美解決問題~~~~~

10. mac 配置yarn 環(huán)境,command not found: yarn,解決無法npm -g的情況遇到問題:zsh: command not found: yarn

解決方案

前提:電腦已安裝node

node -v

npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js

全局安裝

npm install yarn -g

如果這一步?jīng)]有問題,就不需要往下看了,可以直接執(zhí)行 yarn 命令了

11.mac 配置yarn 環(huán)境,如果遇到報錯The operation was rejected by your operating system.npm ERR! It is likely you do not have the permissions to access this file as the current user

XXXX@CN_C02GXXX6M ~ % npm i yarn -g
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/yarn
npm ERR! dest /usr/local/lib/node_modules/.yarn-Jrexx8nI
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/yarn' -> '/usr/local/lib/node_modules/.yarn-Jrexx8nI'
npm ERR!  [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/yarn' -> '/usr/local/lib/node_modules/.yarn-Jrexx8nI'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/usr/local/lib/node_modules/yarn',
npm ERR!   dest: '/usr/local/lib/node_modules/.yarn-Jrexx8nI'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

解決報錯方案一:

sudo npm i yarn -g

解決報錯方案二:(僅限電腦權(quán)限管控嚴格情況下,無法獲取權(quán)限)

step1: 查看npm 全局文件安裝地址
XXX@CN_CXXXMD6M ~ % npm list -g                    
/usr/local/lib
├── @quasar/cli@1.3.2
├── corepack@0.14.1
├── npm@8.19.2
└── yarn@1.22.18

step2: 從其他人電腦上同樣的目錄,拷貝出來兩份文件,一個是命令的快捷方式文件,一個是環(huán)境變量所指的路徑文件,粘貼到自己電腦相同位置
  • 命令快照文件
    npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js
    npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js
    npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js

  • 全局命令所指文件
    npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js

step3: 打開環(huán)境變量配置文件,配置環(huán)境變量
vim ~/.bash_profile

把下面內(nèi)容粘貼到環(huán)境變量文件里,

export PATH=/usr/local/lib/node_modules/yarn/bin/:$PATH

保存.bash_profile的編輯,執(zhí)行一下文件

source ~/.bash_profile

問題解決,大功告成

命令行重新打開,就可以使用yarn

yarn -v

12. MAC npm install -g 報錯permission denied

參考我的這篇文章:超詳細手把手教你四種方案徹底解決MAC npm install -g 報錯permission denied

13. npm 啟動項目報錯 Cannot find module ‘@babel\compat-data\data\corejs3-shipped-proposals’

最近升級了系統(tǒng)的node ,webpack 等等,然后今天打開項目,突然啟動不起來了~~
報錯信息如下:
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'D:\\trunk\node_modules\@babel\compat-data\data\corejs3-shipped-proposals'

搜索了一下資料,按照解決方案來嘗試
方案一:(嘗試過后對我的項目沒有用)
package.json中devDependencies對象添加
  "@babel/compat-data": "7.9.0"
方案二:執(zhí)行下面命令,然后再重新啟動
npm install -D babel-loader @babel/core @babel/preset-env webpack

14. mac npm install -g后仍然不行怎么辦sudo: xxx: command not found

參考我這篇文章:多種方案教你徹底解決mac npm install -g后仍然不行怎么辦sudo: xxx: command not found

15. 解決npm install各種報錯的6種方案 Error: Command failed: cmd.exe autoreconf -ivf以及gifsicle pre-build test failed

參考我這篇文章:解決npm install各種報錯的6種方案 Error: Command failed: cmd.exe autoreconf -ivf以及gifsicle pre-build test failed以及其他報錯

16. nodejs 升級后, vue+webpack 項目 node-sass 報錯的解決方法

如果按照此步驟執(zhí)行有問題,請參考18 解決安裝node-sass報錯的方法

1.當(dāng)我執(zhí)行npm i node-sass -D 在錯誤提示里有給出了方案,重新構(gòu)建 node-sass,命令如下:
npm rebuild node-sass --force

如果執(zhí)行完成后不報錯,就可以了。

如果報 gyp Error 錯誤:
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
....
gyp ERR! node -v v8.11.1 
gyp ERR! node-gyp -v v3.6.2
卸載 node-sass,然后重新安裝。
npm uninstall node-sass
npm install node-sass 
rebuild
## 第一步:
npm rebuild node-sass
## 第二步:
npm update 

如果按照此步驟執(zhí)行有問題,請參考18 解決安裝node-sass報錯的方法

17. npm install報錯 npm ERR! gyp verb which failed Error: not found


PS C:\Users\xiaojin\Downloads\demo-master\demo-master> npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated consolidate@0.15.1: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated @babel/plugin-proposal-optional-chaining@7.9.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.8.3: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm WARN deprecated @babel/plugin-proposal-dynamic-import@7.8.3: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-dynamic-import instead.
npm WARN deprecated @babel/plugin-proposal-numeric-separator@7.8.3: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
npm WARN deprecated @babel/plugin-proposal-object-rest-spread@7.9.5: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.   
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated @babel/plugin-proposal-optional-catch-binding@7.8.3: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.
npm WARN deprecated @babel/plugin-proposal-unicode-property-regex@7.8.8: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-unicode-property-regex instead.
npm WARN deprecated @babel/plugin-proposal-json-strings@7.8.3: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-json-strings instead.
npm WARN deprecated @babel/plugin-proposal-async-generator-functions@7.8.3: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated core-js@2.6.11: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js-pure@3.6.5: core-js-pure@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js-pure.        
npm WARN deprecated core-js@3.6.5: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Users\\xiaojin\\Downloads\\demo-master\\demo-master\\node_modules\\node-gyp\\bin\\node-gyp.js',      
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@21.1.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\which\which.js:89:16      
npm ERR! gyp verb `which` failed     at C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\isexe\index.js:42:5       
npm ERR! gyp verb `which` failed     at C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\isexe\windows.js:36:5     
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:199:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\which\which.js:89:16      
npm ERR! gyp verb `which` failed     at C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\isexe\index.js:42:5       
npm ERR! gyp verb `which` failed     at C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\isexe\windows.js:36:5     
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:199:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python311\python.EXE
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Command failed: C:\Python311\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:422:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:515:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm ERR! gyp ERR! System Windows_NT 10.0.22621
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xiaojin\\Downloads\\demo-master\\demo-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="  
npm ERR! gyp ERR! cwd C:\Users\xiaojin\Downloads\demo-master\demo-master\node_modules\node-sass
npm ERR! gyp ERR! node -v v21.1.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xiaojin\AppData\Local\npm-cache\_logs\2023-12-09T01_37_06_169Z-debug-0.log
PS C:\Users\xiaojin\Downloads\demo-master\demo-master>

解決方案1
# before installing node-gyp on windows
npm install --global --production windows-build-tools

# install node-gyp globally
npm install -g node-gyp
解決方案2

在項目根目錄下創(chuàng)建.npmrc

sass_binary_site=https://npm.taobao.org/mirrors/node-sass/

18. 解決安裝node-sass報錯的方法

方案1:使用淘寶鏡像
npm set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass

方:2:下載源碼放到本地搞~~ 適合內(nèi)網(wǎng)開發(fā)的苦孩子們~~~
  • 先進入https://github.com/sass/node-sass/releases下載自己需要的包
  • 可以點擊tags然后找到自己需要的,然后進行下載
  • 舉例:下載下面這個

https://github.com/sass/node-sass/releases/download/v4.13.1/win32-x64-79_binding.node

  • 下好后,放到本地的文件夾里,使路徑如下
C://Users//AAAAAA//AppData//Roaming//npm-cache//node-sass//4.13.1//win32-x64-79_binding.node
  • 然后按順序復(fù)制下面的代碼到命令行
set SASS_BINARY_PATH="C://Users//AAAAAA//AppData//Roaming//npm-cache//node-sass//4.13.1//win32-x64-79_binding.node"
npm install node-sass@3.4.1

19. 待補充

  • 然后你會發(fā)現(xiàn),安裝成功了~~~~

  • 今天就寫到這里啦~

  • 小伙伴們,( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ我們明天再見啦~~

  • 大家要天天開心哦

歡迎大家指出文章需要改正之處~
學(xué)無止境,合作共贏

npm pnpm yarn 報錯或常見問題處理集錦,前端必備,npm,前端,node.js文章來源地址http://www.zghlxwxcb.cn/news/detail-798847.html

歡迎路過的小哥哥小姐姐們提出更好的意見哇~~

到了這里,關(guān)于npm pnpm yarn 報錯或常見問題處理集錦的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • Pnpm,npm,yarn

    npm ? 最初的npm只是簡單的通過依賴去遞歸安裝包,所以說每個依賴都會有自己的node_modules,node_modules是嵌套的。一個項目會存在多個包,多個包之間難免會有公共的依賴,node_modules嵌套的話,這樣公共依賴就會下載多次。會造成磁盤空間的浪費,較長的下載時間,文件路徑過

    2024年02月09日
    瀏覽(36)
  • npm、yarn和pnpm

    npm、yarn和pnpm

    在npm@3之前是以嵌套結(jié)構(gòu)方式安裝依賴包,存在兩個問題: 依賴路徑太長 多個包依賴一個相同包時,本地磁盤會存儲多個相同的包 npm@ 3和 yarn 使用扁平化結(jié)構(gòu),node_modules變成所有包放在同一層級 注意 :多個版本的包只有一個會被提升至頂層,其他版本的包會嵌套安裝到各自

    2024年02月11日
    瀏覽(35)
  • npm、yarn與pnpm詳解

    npm、yarn與pnpm詳解

    ?? 簡介 : npm 是隨 Node.js 一起安裝的官方包管理工具,它為開發(fā)者搭建了一個龐大的資源庫,允許他們在這個平臺上搜索、安裝和管理項目所必需的各種代碼庫或模塊。 ?? 常用命令 : npm install :安裝package.json中聲明的所有依賴項。 npm install package-name :安裝指定名稱的包

    2024年04月25日
    瀏覽(28)
  • pnpm、npm、yarn的區(qū)別

    pnpm、npm、yarn是三種不同的包管理器,它們之間有一些區(qū)別。 安裝速度:pnpm的安裝速度比npm和yarn快,因為它使用了只下載必需的模塊,而不是下載整個依賴樹。此外,pnpm還可以并行下載模塊,從而進一步提高下載速度。 占用空間:pnpm的占用空間比npm和yarn小,因為它只下載

    2024年02月08日
    瀏覽(25)
  • npm、yarn、pnpm如何清除緩存?

    npm、yarn、pnpm如何清除緩存?

    前端工程化創(chuàng)建項目會經(jīng)常使用各種安裝包管理工具,安裝各種前端依賴包。例如,npm、yarn、pnpm等。時間一長,各種安裝包管理工具的在安裝依賴時,留下的緩存文件就會變得很大,以至于影響系統(tǒng)的運行,因此必要時清除緩存就是一個不錯的選擇。本文將著重介紹npm、y

    2024年02月07日
    瀏覽(29)
  • npm, yarn和pnpm清理緩存

    npm, yarn和pnpm是時下主流的node.js包管理器。 隨著前端項目的增多,會下載許多的依賴。不管是哪種包管理器,都會使用緩存來增加下次下載的速度。但很多情況下緩存文件不會被自動清空,如果不手動清理,可能會占用非常多系統(tǒng)盤的存儲空間。 為此,本文記錄了三種包管理

    2024年01月20日
    瀏覽(29)
  • npm yarn pnpm 命令集

    安裝依賴 安裝某個依賴 安裝到全局(dependencies) 安裝到線下(devDependencies) 卸載某個依賴 卸載全局依賴 清除npm緩存 如果清除緩存報禁止--force錯誤 可以使用以下這條 安裝pnpm 打開CMD命令行 輸入 查看版本號 安裝依賴 安裝某個依賴 刪除某個依賴 更新所有依賴 更新某個依賴

    2024年02月12日
    瀏覽(43)
  • “yarn“、“npm“、“cnpm“和“pnpm“的區(qū)別

    npm(Node Package Manager)是Node.js的默認包管理器。它是一個全球最大的開源軟件注冊表,擁有數(shù)量龐大的包供開發(fā)者使用。npm具有廣泛的生態(tài)系統(tǒng)和大量的社區(qū)支持。 軟件包數(shù)量龐大,幾乎包含了所有常見的開源庫和工具。 社區(qū)活躍,有大量的文檔、教程和支持。 可以方便地

    2024年02月11日
    瀏覽(38)
  • 【JavaScript】npm、Yarn 和 pnpm 的區(qū)別

    npm、Yarn 和 pnpm 都是用于管理和構(gòu)建 JavaScript 項目的包管理工具,以下是它們之間的一些區(qū)別和特點。 npm(Node Package Manager): npm 是 Node.js 官方提供的包管理工具,是 JavaScript 生態(tài)系統(tǒng)中使用最廣泛的包管理工具之一。 npm 使用 package.json 文件來記錄項目的依賴關(guān)系和配置信

    2024年02月16日
    瀏覽(23)
  • 運行 `npm install` 時的常見問題與解決方案

    描述: 運行 npm install 時,可能會遇到網(wǎng)絡(luò)連接問題,導(dǎo)致無法正常下載依賴包。 報錯示例: npm ERR! network connection timed out npm ERR! connect ETIMEDOUT npm ERR! getaddrinfo EAI_AGAIN 解決方案: 確保你的計算機已連接到互聯(lián)網(wǎng)??梢試L試打開瀏覽器,訪問其他網(wǎng)頁來確認網(wǎng)絡(luò)連接正常。 檢

    2024年02月07日
    瀏覽(37)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包