1

我正在尝试安装 w3c 的 respec 项目的依赖项,但出现此错误

npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> respec@19.6.0 prepublish C:\Users\MUJ\Desktop\respec
> npm run snyk-protect

> respec@19.6.0 snyk-protect C:\Users\MUJ\Desktop\respec
> snyk protect

Snyk couldn't patch the specified vulnerabilities because GNU's patch is not available. Please install 'patch' and try again.

npm ERR! code ELIFECYCLE 
npm ERR! errno 1
npm ERR! respec@19.6.0 snyk-protect: `snyk protect`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the respec@19.6.0 snyk-protect script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! respec@19.6.0 prepublish: `npm run snyk-protect`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the respec@19.6.0 prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我尝试使用给定的命令安装补丁。这是我每次运行“npm install patch”时得到的结果

C:\Users\MUJ\Desktop\respec>npm install patch
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ patch@0.0.1
added 1 package in 22.255s

C:\Users\MUJ\Desktop\respec>npm install
npm WARN rollback Rolling back ajv@4.11.8 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'C:\Users\MUJ\Desktop\respec\node_modules\fsevents\node_modules'
npm WARN rollback Rolling back tar-pack@3.4.0 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'C:\Users\MUJ\Desktop\respec\node_modules\fsevents\node_modules'
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.

> respec@19.6.0 prepublish C:\Users\MUJ\Desktop\respec
> npm run snyk-protect

> respec@19.6.0 snyk-protect C:\Users\MUJ\Desktop\respec
> snyk protect

Snyk couldn't patch the specified vulnerabilities because GNU's patch is not available. Please install 'patch' and try again.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! respec@19.6.0 snyk-protect: `snyk protect`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the respec@19.6.0 snyk-protect script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! respec@19.6.0 prepublish: `npm run snyk-protect`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the respec@19.6.0 prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

我应该怎么做才能解决这个问题?

4

1 回答 1

0

这不是 npm 问题:这是 Windows 操作系统二进制问题。这篇文章在这里讨论了这个问题。

基本上,您需要在您的环境 %PATH% 变量中提供可用的 patch.exe。

如果您还没有安装它,似乎可以在这里找到它们。

干杯。

于 2018-02-18T10:20:05.973 回答