尝试运行 parcel 命令时出现错误消息。 (Windows Powershell)

问题描述 投票:0回答:2

我在开始学习 React 时尝试安装 parcel。当我设置我的文件并尝试在 powershell 命令行中使用 parcel 时,它给了我这个错误。我不知道该怎么办。

Package.json 文件:

    {
  "name": "project",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.html",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "parcel src/index.html",
    "build": "parcel build src/index.html"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/github/project.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/github/project/issues"
  },
  "homepage": "https://github.com/github/project#readme",
  "dependencies": {
    "react": "^17.0.2",
    "react-dom": "^17.0.2"
  }
}

我安装了什么:

npm install -g parcel@next
npm install --save react react-dom

npm package.json parceljs
2个回答
1
投票

安装旧版本帮助了我:

npm install -g [email protected]

然后

parcel index.html

作品。


0
投票

使用 npx 实用程序运行命令,即 npx parcel index.html。

© www.soinside.com 2019 - 2024. All rights reserved.