我无法打包.js npm并得到错误

问题描述 投票:-1回答:1
 C:\Program Files\nodejs\MangaBackEnd>npm init
    This utility will walk you through creating a package.json file.
    It only covers the most common items, and tries to guess sensible defaults.
    See `npm help json` for definitive documentation on these fields
    and exactly what they do.
    Use `npm install <pkg>` afterwards to install a package and
    save it as a dependency in the package.json file.
    Press ^C at any time to quit.
    package name: (mangabackend) mangabackend
    version: (1.0.0) 1.0.0
    description:
    entry point: (index.js)
    test command:
    git repository:
    keywords:
    author: Vansh Ranga
    license: (ISC) isc
    Sorry, license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>" and license is similar to the valid expression "ISC".
    license: (ISC) ISC
    About to write to C:\Program Files\nodejs\MangaBackEnd\package.json:
    {
      "name": "mangabackend",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "Vansh Ranga",
      "license": "ISC"
    }
    Is this OK? (yes) yes
    npm ERR! code EPERM
    npm ERR! syscall open
    npm ERR! path C:\Program Files\nodejs\MangaBackEnd\package.json
    npm ERR! errno -4048
    npm ERR! Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\MangaBackEnd\package.json'
    npm ERR!  [Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\MangaBackEnd\package.json'] {
    npm ERR!   stack: "Error: EPERM: operation not permitted, open 'C:\\Program Files\\nodejs\\MangaBackEnd\\package.json'",
    npm ERR!   errno: -4048,
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'open',
    npm ERR!   path: 'C:\\Program Files\\nodejs\\MangaBackEnd\\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\vansh\AppData\Roaming\npm-cache\_logs\2019-12-21T11_46_58_279Z-debug.log
    C:\Program Files\nodejs\MangaBackEnd>
npm command-prompt package.json
1个回答
0
投票

这是permission问题,请给complete permissions

错误:EPERM:不允许操作,打开'C:\ ProgramFiles \ nodejs \ mangabackend \ MangaBackEnd \ package.json'

此错误表示您无法在package.json中创建MangaBackEnd folder文件>

C:\ProgramFiles\nodejs\mangabackend\MangaBackEnd

((或)

您可以用Administrator打开命令提示符

,也可以这样做。
© www.soinside.com 2019 - 2024. All rights reserved.