Node.js 无法安装 gulp

Node.js 无法安装 gulp

我已经安装了 node.js,并尝试使用 npm 安装 gulp 进行 Web 开发,但是我收到了 gulp 错误:

$ npm i gulp browser-sync gulp-sass --save-dev
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/gulp failed, reason: unable to
get local issuer certificate

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\adm_esaleh\AppData\Roaming\npm-cache\_logs\2018-12-
06T12_30_15_756Z-debug.log

注意:我认为我的笔记本电脑的证书存在一些问题,我在尝试安装 Flask for python 时也遇到了同样的问题...

这是日志文件:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'i',
1 verbose cli   'gulp',
1 verbose cli   'browser-sync',
1 verbose cli   'gulp-sass',
1 verbose cli   '--save-dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session f28198ba7c900435
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for gulp@latest request to https://registry.npmjs.org/gulp failed, reason: unable to get local issuer certificate
8 silly fetchPackageMetaData error for browser-sync@latest request to https://registry.npmjs.org/browser-sync failed, reason: unable to get local issuer certificate
9 silly fetchPackageMetaData error for gulp-sass@latest request to https://registry.npmjs.org/gulp-sass failed, reason: unable to get local issuer certificate
10 timing stage:rollbackFailedOptional Completed in 2ms
11 timing stage:runTopLevelLifecycles Completed in 3698ms
12 verbose type system
13 verbose stack FetchError: request to https://registry.npmjs.org/gulp failed, reason: unable to get local issuer certificate
13 verbose stack     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
13 verbose stack     at ClientRequest.emit (events.js:182:13)
13 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:391:9)
13 verbose stack     at TLSSocket.emit (events.js:182:13)
13 verbose stack     at emitErrorNT (internal/streams/destroy.js:82:8)
13 verbose stack     at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
13 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
14 verbose cwd C:\Users\adm_esaleh\Desktop\farmetly\f_project_0
15 verbose Windows_NT 6.1.7601
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "gulp" "browser-sync" "gulp-sass" "--save-dev"
17 verbose node v10.14.1
18 verbose npm  v6.4.1
19 error code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
20 error errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
21 error request to https://registry.npmjs.org/gulp failed, reason: unable to get local issuer certificate
22 verbose exit [ 1, true ]

相关内容