每次使用npm install恢复已删除的节点模块都会失败

我正在使用React进行项目。 node_modules文件夹在不知不觉中被删除,因此我试图通过再次运行npm install来恢复它。

但是,此步骤将安装一些软件包,并在以下位置弹出此错误。我已经遵循了thisthis之类的几个可用选项,但仍然无法解决此问题。

  • 节点版本:v10.16.3
  • npm版本:6.9.0

这是错误输出:

    D:\Projects\ReactJsProjects\portal_app>workon projects
(projects) D:\Projects\ReactJsProjects\portal_app>npm install

> scrypt@6.0.3 preinstall D:\Projects\ReactJsProjects\portal_app\node_modules\scrypt
> node node-scrypt-preinstall.js


> websocket@git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2 install D:\Projects\ReactJsProjects\portal_app\node_modules\@makerdao\dai\node_modules\websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)


(projects) D:\Projects\ReactJsProjects\portal_app\node_modules\@makerdao\dai\node_modules\websocket>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 

> scrypt@6.0.3 install D:\Projects\ReactJsProjects\portal_app\node_modules\scrypt
> node-gyp rebuild


(projects) D:\Projects\ReactJsProjects\portal_app\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: C:\Users\Bob\Envs\projects\Scripts\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>",line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at maybeclose (internal/child_process.js:982:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Projects\ReactJsProjects\portal_app\node_modules\scrypt
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.0.1 requires a peer of eslint-plugin-react-hooks@1.x but none is installed. You must install peer dependencies yourself.
npm WARN eth-eip712-util@2.3.0 requires a peer of bn.js@^5.0.0 but none is installed. You must install peer dependencies yourself.       
npm WARN eth-eip712-util@2.3.0 requires a peer of keccak@^2.0.0 but none is installed. You must install peer dependencies yourself.      
npm WARN ts-pnp@1.1.2 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Bob\AppData\Roaming\npm-cache\_logs\2019-11-05T11_25_30_954Z-debug.log
wx071134 回答:每次使用npm install恢复已删除的节点模块都会失败

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3159978.html

大家都在问