1.1. p1
Q:
> gulp
fs.js:35
} = primordials;
^
ReferenceError: primordials is not defined
场景:npm run build 时候报错
```
node -v v12.18.2 npm -v 6.14.5 gulp -v CLI version: 2.3.0 Local version: Unknown or 3.9.1
```
```
分析/原因: node 版本和gulp版本不一致导致的。 node12及以上对应gulp4及以上。
解决方案:
方案一:降低node版本。
下载旧版本node
注意环境变量的切换配置
linux 上可用 n模块。来源于npm 安装n模块。
root@iz2ze56pkpg6dxap2z3qvzz ~]# npm i -g n /usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n + n@6.5.1 added 1 package from 4 contributors in 1.492s
切换node版本
方案二:提升gulp版本到4。注意:gulp4后的语法有所改变。gulpfile.js要改
https://www.sitepoint.com/how-to-migrate-to-gulp-4/
参考:
1.2. p2
Q: npm install 报 npm ERR! chromedriver@2.27.2 install: node install.js
错误
[root@iz2ze56pkpg6dxap2z3qvzz workspace]# npm install
> chromedriver@2.27.2 install /var/lib/jenkins/jobs/Freestyle_renren-fast-vue/workspace/node_modules/chromedriver
> node install.js
Downloading https://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip
Saving to /var/lib/jenkins/jobs/Freestyle_renren-fast-vue/workspace/node_modules/chromedriver/chromedriver/chromedriver_linux64.zip
events.js:174
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:
at TLSSocket.socketErrorListener (_http_client.js:392:9)
at TLSSocket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm WARN The package gulp is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chromedriver@2.27.2 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chromedriver@2.27.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
A:
删除 node_modules rm -rf node_modules
用淘宝源重新安装
npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver
1.3. P3
Q: POSTMAN 黑屏问题,postman打开不显示。
A: 加环境变量。变量名(N): POSTMAN_DISABLE_GPU 变量值(V):true