npm i --save-dev prettier安装警告saveError enoent
出现问题的情况:
或者:
D:\Program Files\nodejs>npm i --save-dev prettier
npm WARN saveError ENOENT: no such file or directory, open 'D:\Program Files\nodejs\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'D:\Program Files\nodejs\package.json'
npm WARN nodejs No description
npm WARN nodejs No repository field.
npm WARN nodejs No README data
npm WARN nodejs No license field.
+ prettier@1.15.3
added 1 package from 1 contributor and audited 5020 packages in 7.879s
found 0 vulnerabilities
解决方法一:
D:\Program Files\nodejs>cd node_modules\npm
D:\Program Files\nodejs\node_modules\npm>npm i --save-dev prettier
npm notice created a lockfile as package-lock.json. You should commit this file.
+ prettier@1.15.3
added 1 package from 1 contributor and audited 5019 packages in 3.56s
found 0 vulnerabilities
解决方法二:
将D:\Program Files\nodejs\node_modules\npm 目录下的package.json复制到
打开cmd的当前路径下(C:\Users\rfzhang>)再执行npm i --save-dev prettier命令。
运行结果:
更多资讯可关注下方公众号获取