I can't make package .js npm and get errors

∥☆過路亽.° 提交于 2019-12-25 17:27:10

问题


 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>

回答1:


This is a permission issue, Please give complete permissions to

Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\mangabackend\MangaBackEnd\package.json'

This error meant that you are unable to create package.json file inside MangaBackEnd folder

C:\ProgramFiles\nodejs\mangabackend\MangaBackEnd

(Or)

You can open command prompt with Administrator and can also do it.



来源:https://stackoverflow.com/questions/59435961/i-cant-make-package-js-npm-and-get-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!