今天有个软件需要使用 Electron,于是我就决定自己编译一波,然后就遇到了各种坑,这里本来想一路解决下来的,解决发现坑太多了,所以就放弃了,但是还是有一些可以记录一下的。

1. npm i E503

  1. [[email protected].io]# npm i
  2. npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
  3. npm WARN [email protected].4.1 No repository field.
  4. npm ERR! code E503
  5. npm ERR! 503 Too many open connections: [email protected].5.2
  6. npm WARN tar ENOENT: no such file or directory, open '/home/liuliqiang/soft/github.com/willnewii/qiniuClient/node_modules/.staging/pump-a4a1170b/test-browser.js'
  7. npm WARN tar ENOENT: no such file or directory, open '/home/liuliqiang/soft/github.com/willnewii/qiniuClient/node_modules/.staging/pump-a4a1170b/test-node.js'
  8. npm ERR! A complete log of this run can be found in:
  9. npm ERR! /root/.npm/_logs/2019-10-29T03_13_34_371Z-debug.log

问题原因:没有指定 registry

  1. 查看配置:
  1. [[email protected].io]# npm config list
  2. ; cli configs
  3. metrics-registry = "https://registry.npmjs.org/"
  4. scope = ""
  5. user-agent = "npm/6.4.1 node/v10.15.3 linux x64"
  6. ; project config /home/liuliqiang/soft/github.com/willnewii/qiniuClient/.npmrc
  7. electron_mirror = "http://npm.taobao.org/mirrors/electron/"
  8. sass_binary_site = "https://npm.taobao.org/mirrors/node-sass/"
  9. ; node bin location = /usr/bin/node
  10. ; cwd = /home/liuliqiang/soft/github.com/willnewii/qiniuClient
  11. ; HOME = /root
  12. ; "npm config ls -l" to show all defaults.
  1. 添加 Registry
  1. [[email protected].io]# npm config set registry http://registry.npmjs.org/

2. npm i E418

  1. [[email protected].io]# npm config set strict-ssl false
  2. [[email protected].io]# npm config set registry https://registry.npmjs.org/

3. ajv-[email protected] requires a peer of [email protected]^6.9.1 but none is installed.

  1. [[email protected].io]# npm i ajv

4. The ‘mode’ option has not been set. Set ‘mode’ option to ‘development’ or ‘production’ to enable defaults for this environment.

  1. 救不动了......