node 启动项目失败-解决方法收集

问题 1

info There appears to be trouble with your network connection. Retrying...
error Error: certificate has expired
    at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)
    at TLSSocket.emit (node:events:518:28)
    at TLSSocket._finishInit (node:_tls_wrap:1085:8)
    at ssl.onhandshakedone (node:_tls_wrap:871:12)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

方法

yarn config set ignore-engines true
yarn config set strict-ssl false  

任意一个
npm config set registry http://registry.cnpmjs.org 
 
npm config set registry http://registry.npm.taobao.org

问题2

PS D:\work\Mall-Cook> yarn bootstrap
yarn : 无法加载文件 D:\app\nodejs\node_global\yarn.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ yarn bootstrap
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

方法

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

问题3

error Error: getaddrinfo ENOTFOUND registry.nlark.com
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

方法

修改yarn.lock文件里registry.nlark.com  改为 registry.npmmirror.com

问题4

npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmmirror.com/vuepress/-/vuepress-1.8.2.tgz failed, reason: getaddrinfo ENOTFOUND registry.npmmirror.com
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

方法

npm config set strict-ssl false

window node 版本切换
下载 nvm
https://github.com/coreybutler/nvm-windows/releases
安装后
nvm install特定版本

nvm ls 查看所有版本

nvm use 版本 即可

问题

image.png

方法

npx pnpm install
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容