笔记笔记
  • Home
  • AI&ML
  • Example
  • Zoo
  • 关于
⌘ K
Node.js
Svelte
数据大屏幕
最后更新时间:
Copyright © 2023-2024 | Powered by dumi | GuoDapeng | 冀ICP备20004032号-1 | 冀公网安备 冀公网安备 13024002000293号

TABLE OF CONTENTS

‌
‌
‌
‌

Node.js

Node.js - brew install

docker

使用 docker 创建 node 环境。

#!/bin/bash
docker run -it --rm -w /app \
-v $PWD:/app \
-p 8280:8000 \
node:23 bash -c "yarn config set registry http://192.168.30.202:8081/repository/npm-group/ && npm config set registry http://192.168.30.202:8081/repository/npm-group/ && bash"
# npm 决依赖冲突很差
# npm config get registry
# npm install
# npm update
# npm run dev -- --port 8000 --host 0.0.0.0
# yarn 决依赖冲突比 npm 好
# yarn install
# yarn upgrade
# yarn dev --port 8000 --host 0.0.0.0

npm

查看安装的东西

➜ npm ls -g --depth 0
├── @ant-design/pro-cli@3.2.1
├── @ionic/cli@7.2.0
├── corepack@0.29.4
└── npm@10.9.0

npm

# 查看当前仓库
npm config get registry
# 设置镜像源
npm config set registry https://registry.npmmirror.com
# 还原
npm config set registry https://registry.npmjs.org
# 查看缓存文件目录
npm config get cache
# 清除缓存
npm cache clean --force

yarn - brew install

# 查看当前仓库
yarn config get registry
# 设置镜像源
yarn config set registry https://registry.npmmirror.com
# 还原
yarn config set registry https://registry.yarnpkg.com
# 查看缓存文件目录
yarn cache dir
# 清除缓存
yarn cache clean
# 查看已缓存包的列表
yarn cache list

pnpm - brew install

# 查看当前仓库
pnpm config get registry
# 设置镜像源
pnpm config set registry https://registry.npmmirror.com
# 还原
pnpm config set registry https://registry.npmjs.org
# 查看缓存文件目录
pnpm store path
# 清除缓存
pnpm store prune

异常处理

root@bt:/www/node/3d-china-map# yarn install
yarn install v1.22.21
[1/4] Resolving packages...
[2/4] Fetching packages...
error Error: certificate has expired
at TLSSocket.onConnectSecure (_tls_wrap.js:1514:34)
at TLSSocket.emit (events.js:400:28)
at TLSSocket._finishInit (_tls_wrap.js:936:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:708:12)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
# 关闭 strict-ssl
yarn config set strict-ssl false
# 查看 config
yarn config list