Package must have a name field to be linked

nodejs 文章 2021-12-27 22:15 538 0 全屏看文

AI助手支持GPT4.0

今天在使用

npm link

的时候提示了:

Package must have a name field to be linked

或者提示

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\workspace\gitee\zz-plugins\zz-translate\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\workspace\gitee\zz-plugins\zz-translate\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     G:\npm_file\npm_cache\_logs\2021-12-27T14_18_28_190Z-debug.log

解决方案就是:

要现在nodejs项目目录下执行

npm init -y

然后就会出现一串提示,并且在目录下出现了 package.json

image.png


然后我们再执行

npm link

就好了

-EOF-

AI助手支持GPT4.0