今天在使用
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
然后我们再执行
npm link
就好了