【问题标题】:How do i fix "npm does not support Node.js v12.14.1" when they came from the same LTS download?当它们来自相同的 LTS 下载时,如何修复“npm 不支持 Node.js v12.14.1”?
【发布时间】:2020-05-30 16:46:46
【问题描述】:

说实话,这在我的任何开发环境中都没有发生过 我的节点版本:12.14.1 我的 npm 版本:6.13.4

我正在使用 Sanity.io 作为 CRM 构建 Gatsby 站点,但我收到此错误:

ahinds$ npm run dev

> sanity-gatsby-blog@1.0.7 dev /Users/ahinds/Desktop/AHinds/dev/LMPropertyMgmt
> lerna run dev --parallel

lerna notice cli v3.20.2
lerna info Executing command in 2 packages: "npm run dev"
sanity-gatsby-blog-web: npm WARN npm npm does not support Node.js v12.14.1
sanity-gatsby-blog-web: npm WARN npm You should probably upgrade to a newer version of node as we
sanity-gatsby-blog-web: npm WARN npm can't make any promises that npm will work with this version.
sanity-gatsby-blog-web: npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9, 10.
sanity-gatsby-blog-web: npm WARN npm You can find the latest version at https://nodejs.org/
sanity-gatsby-blog-studio: npm WARN npm npm does not support Node.js v12.14.1
sanity-gatsby-blog-studio: npm WARN npm You should probably upgrade to a newer version of node as we
sanity-gatsby-blog-studio: npm WARN npm can't make any promises that npm will work with this version.
sanity-gatsby-blog-studio: npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9, 10.
sanity-gatsby-blog-studio: npm WARN npm You can find the latest version at https://nodejs.org/
sanity-gatsby-blog-web: > sanity-gatsby-blog-web@1.0.1 dev /Users/ahinds/Desktop/AHinds/dev/LMPropertyMgmt/web
sanity-gatsby-blog-web: > npm run clean-cache && gatsby develop
sanity-gatsby-blog-studio: > sanity-gatsby-blog-studio@1.0.5 dev /Users/ahinds/Desktop/AHinds/dev/LMPropertyMgmt/studio
sanity-gatsby-blog-studio: > sanity start
sanity-gatsby-blog-web: npm WARN npm npm does not support Node.js v12.14.1
sanity-gatsby-blog-web: npm WARN npm You should probably upgrade to a newer version of node as we
sanity-gatsby-blog-web: npm WARN npm can't make any promises that npm will work with this version.
sanity-gatsby-blog-web: npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9, 10.
sanity-gatsby-blog-web: npm WARN npm You can find the latest version at https://nodejs.org/
sanity-gatsby-blog-studio: Error occured trying to resolve project root:
sanity-gatsby-blog-studio: Unexpected token ] in JSON at position 425
sanity-gatsby-blog-studio: npm ERR! code ELIFECYCLE
sanity-gatsby-blog-studio: npm ERR! errno 1
sanity-gatsby-blog-studio: npm ERR! sanity-gatsby-blog-studio@1.0.5 dev: `sanity start`
sanity-gatsby-blog-studio: npm ERR! Exit status 1
sanity-gatsby-blog-studio: npm ERR! 
sanity-gatsby-blog-studio: npm ERR! Failed at the sanity-gatsby-blog-studio@1.0.5 dev script.
sanity-gatsby-blog-studio: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
sanity-gatsby-blog-web: > sanity-gatsby-blog-web@1.0.1 clean-cache /Users/ahinds/Desktop/AHinds/dev/LMPropertyMgmt/web
sanity-gatsby-blog-web: > gatsby clean
sanity-gatsby-blog-studio: npm ERR! A complete log of this run can be found in:
sanity-gatsby-blog-studio: npm ERR!     /Users/ahinds/.npm/_logs/2020-02-14T21_27_42_015Z-debug.log
lerna ERR! npm run dev exited 1 in 'sanity-gatsby-blog-studio'
lerna ERR! npm run dev stdout:

> sanity-gatsby-blog-studio@1.0.5 dev /Users/ahinds/Desktop/AHinds/dev/LMPropertyMgmt/studio
> sanity start


lerna ERR! npm run dev stderr:
npm WARN npm npm does not support Node.js v12.14.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9, 10.
npm WARN npm You can find the latest version at https://nodejs.org/
Error occured trying to resolve project root:
Unexpected token ] in JSON at position 425
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sanity-gatsby-blog-studio@1.0.5 dev: `sanity start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sanity-gatsby-blog-studio@1.0.5 dev 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!     /Users/ahinds/.npm/_logs/2020-02-14T21_27_42_015Z-debug.log

lerna ERR! npm run dev exited 1 in 'sanity-gatsby-blog-studio'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sanity-gatsby-blog@1.0.7 dev: `lerna run dev --parallel`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sanity-gatsby-blog@1.0.7 dev 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!     /Users/ahinds/.npm/_logs/2020-02-14T21_27_42_097Z-debug.log

知道为什么这个版本的 node 不能和这个版本的 npm 一起工作吗?我从 NOde.js 网站安装了它们,所以它们被打包在一起了。

这是我的Repo

【问题讨论】:

  • 嗨,艾弗里,你能检查一下这个错误吗Unexpected token ] in JSON at position 425
  • @salesh 好的,我会调查一下我不知道位置 425 在哪里。生病将我的回购添加到问题中。
  • 删除 package-lock.json 和 node_modules,然后执行 npm install,然后尝试

标签: node.js npm npm-install gatsby sanity


【解决方案1】:

所以我很确定这是你的问题

sanity-gatsby-blog-studio: Error occured trying to resolve project root:
sanity-gatsby-blog-studio: Unexpected token ] in JSON at position 425

不要打扰 WARN 没关系

编辑 1

尝试删除package-lock.json和node_modules,然后执行npm install,然后尝试

编辑 2

在分析代码错误后 工作室-> sanity.json

如果你愿意,我可以提出拉取请求,但这是很小的变化,所以去试试吧:)

【讨论】:

  • 再次感谢@salesh,我会将我的回购添加到问题中,我似乎无法找到这是从哪里来的
  • smh 重新安装给我带来了 51 个漏洞,我也意识到该项目正在使用 npm 5.10.0 但是当我尝试更新它时,我得到相同的“npm 不支持节点”错误”
  • 抱歉,我放假了一个星期,迟到了。这个修复看起来很有希望。我会检查一下,然后回到这里。感谢您的帮助!!!
【解决方案2】:

根据here 的详细信息,它们应该相互兼容。

我建议你使用 'npm uninstall -g npm' 和 nodejs 来卸载 npm。然后重新安装 nodejs 可能会解决问题。

【讨论】:

    猜你喜欢
    • 2019-09-04
    • 1970-01-01
    • 2021-04-09
    • 1970-01-01
    • 2018-04-23
    • 1970-01-01
    • 2020-11-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多