0

老实说,这在任何开发环境中都没有发生过我的节点版本: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

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

这是我的回购

4

2 回答 2

2

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

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

在此处输入图像描述

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

于 2020-02-14T21:57:02.497 回答
1

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

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

于 2020-02-14T21:52:04.793 回答