英文:
How to solve this error while installing Next.js with yarn - options.env['npm_config__p_a_c_k_a_g_e___l_o_c_k_']' must be a string without null bytes
问题
在使用"yarn create next-app"
创建Next.js应用时,出现了以下错误 - 发生了意外错误:“属性 'options.env['npm_config__p_a_c_k_a_g_e___l_o_c_k_']' 必须是一个不带空字节的字符串。收到了 ''\x00t\x00r\x00u\x00e\x00''”
。
Node 版本 - 19.4.0
NPM 版本 - 9.7.2
Yarn 版本 - 1.22.19
create-next-app codeswear
这个命令可以正常工作,但我无法使用这个命令安装旧版本的 Next.js。
yarn create next-app@latest
和 yarn create next-app@12
- 我也尝试了这些命令,但没有成功。
我尝试了很多方法,但都没有成功。
英文:
While creating a Next.js app with yarn using "yarn create next-app"
, it throws this error - An unexpected error occurred: "The property 'options.env['npm_config__p_a_c_k_a_g_e___l_o_c_k_']' must be a string without null bytes. Received '\x00t\x00r\x00u\x00e\x00'"
Node version - 19.4.0
NPM version - 9.7.2
Yarn version - 1.22.19
create-next-app codeswear
This command works fine, but I can't install the older versions of Next.js with this command.
yarn create next-app@latest
and yarn create next-app@12
- I also tried these commands but did not work.
I tried many things but nothing worked at all.
答案1
得分: 1
我在使用StencilJS项目时遇到了与Yarn类似的问题。对我有用的解决方法是删除我的主目录中的.npmrc
和.yarnrc
文件。如果你不想丢失这些文件的内容,在你修改它们之前,务必先备份它们。
Yarn在设置项目时会读取NPM和Yarn的配置文件。如果Yarn由于某种原因无法解析这些文件中的数据,它将会抛出错误。
英文:
I ran into a similar issue with Yarn while working with a StencilJS project. The thing that solved it for me was deleting the .npmrc
and .yarnrc
files in my home directory. If you don't want to lose the contents of those files, obviously back them up before you mess with them.
Yarn is reading the NPM and Yarn configuration files during the process of setting up a project. If Yarn can't parse the data in those files for one reason or another, it will throw an error.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论