【问题标题】:npm install not working, can't install any of the node modules after cloning my project from gitnpm install 不工作,从 git 克隆我的项目后无法安装任何节点模块
【发布时间】:2021-07-05 05:56:58
【问题描述】:

我从 git 克隆了我的项目,但在尝试执行 npm install 时,它不起作用。

我无法修复任何错误 - 例如,当尝试使用 npm install --save core-js@^3 修复 core-js 错误时,我仍然收到相同的消息,我需要升级。

为什么会这样?在我克隆这个 repo 之前没有错误?

npm WARN deprecated @babel/polyfill@7.12.1: ???? This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm ERR! code 1
npm ERR! path C:\Users\User\Desktop\mydailyprep\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@14.16.1 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                       ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (child_process.js:308:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! gyp ERR! System Windows_NT 10.0.17134
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User\\Desktop\\myapp\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\User\Desktop\mydailyprep\node_modules\node-sass
npm ERR! gyp ERR! node -v v14.16.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User\AppData\Local\npm-cache\_logs\2021-04-09T10_33_10_047Z-debug.log

【问题讨论】:

标签: javascript node.js npm


【解决方案1】:

即使我也遇到过同样的问题...这可能对您有帮助.. :)

我创建了一个名为“projects (Folder Name)”的文件夹,其中我已经克隆了我的项目 - 名为“xyz project (projects >> xyz project)”..

现在我错误地尝试安装 - npm install in "projects folder (parent folder)"..

但节点模块必须安装在“xyz 项目”(子文件夹)中

所以当我在 xyz 项目中使用 npm i... 时,节点模块已成功安装..

试试这个..

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center。
【解决方案2】:

试试:

npm cache clean --force
npm install

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-18
    • 1970-01-01
    • 2019-12-23
    • 1970-01-01
    • 2018-08-03
    • 1970-01-01
    • 2023-03-21
    • 2018-02-08
    相关资源
    最近更新 更多