Node.js/npm:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第68行: 第68行:
# [https://github.com/privatenumber/pkg-size.dev pkg-size.dev]
# [https://github.com/privatenumber/pkg-size.dev pkg-size.dev]
# [https://github.com/pastelsky/bundlephobia bundlephobia.com]
# [https://github.com/pastelsky/bundlephobia bundlephobia.com]
== error ==
* rollbackFailedOptional
*: {{shc|<syntaxhighlight lang="bash">
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
npm i
git config --global --unset http.proxy
git config --global --unset https.proxy</syntaxhighlight>|$}}
* permission denied, mkdir '/usr/local/lib/node_modules/node-sass/.node-gyp'
*: {{shc|<syntaxhighlight lang="bash">
sudo npm install node-sass --unsafe-perm --save-dev</syntaxhighlight>|$}}
* Error: ENOSPC: System limit for number of file watchers reached
*: 文件监视程序的系统产生了限制,达到了默认上限。
{{shc_out|<syntaxhighlight lang="bash">
cat /proc/sys/fs/inotify/max_user_watches
</syntaxhighlight>|<syntaxhighlight lang="javascript">
8192
</syntaxhighlight>|$}}
*: 临时增加文件监听限制
*: {{shc|<syntaxhighlight lang="bash">
sudo sysctl fs.inotify.max_user_watches=524288</syntaxhighlight>|$}}
*: 永久增加
*: {{shc|<syntaxhighlight lang="bash">
echo fs.inotify.max_user_watches = 524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p</syntaxhighlight>|$}}
* Node Sass could not find a binding for your current environment
*: 重新添加 sass 依赖
*: {{shc|<syntaxhighlight lang="bash">
npm rebuild node-sass</syntaxhighlight>|$}}
* Error: EACCES: permission denied, mkdir '/opt/nodejs/node-v12.18.2-linux-x64/lib/node_modules/node-sass/.node-gyp'
*: <syntaxhighlight lang="bash">
sudo npm install node-sass --unsafe-perm --save-dev</syntaxhighlight>
* This is probably not a problem with npm. There is likely additional logging
* Error: connect ETIMEDOUT 104.20.23.46:443 gyp ERR! stack    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
*: <syntaxhighlight lang="bash">
rm -rf ~/.node-gyp</syntaxhighlight>
* wsl, Error: EACCES: permission denied, rename
: {{shc|<syntaxhighlight lang="bash">
npm config set unsafe-perm=true
npm config set prefix="/mnt/d/npm-global"</syntaxhighlight>|$|/home/kangkk}}
* ERESOLVE unable to resolve dependency tree
: node版本太高了