首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法创建package.json

无法创建package.json
EN

Stack Overflow用户
提问于 2020-06-14 16:18:51
回答 1查看 62关注 0票数 0

甚至我尝试了设置执行策略为无限制,这解决了我的虚拟服务错误,但无法创建package.json

输出粘贴在下面。请注意:我同时尝试了npm initnpm init -y

代码语言:javascript
复制
PS C:\Windows\System32\WindowsPowerShell\v1.0> npm init -y
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Windows\System32\WindowsPowerShell\v1.0\package.json
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Windows\System32\WindowsPowerShell\v1.0\package.json'
npm ERR!  [Error: EPERM: operation not permitted, open 'C:\Windows\System32\WindowsPowerShell\v1.0\package.json'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\package.json'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-06-14T08_03_04_050Z-debug.log
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-06-14 16:35:14

您不能创建package.json,因为您处于C:\Windows\System32下。Windows正在阻止您创建自己的保存系统文件的文件。

切换到另一个目录(最好是C:\Users\YourUsernameHere\下的目录),然后重试。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62370053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档