使用Parcel.js部署到Netlify失败

时间:2019-07-03 23:39:01

标签: netlify parceljs

正如标题所述,部署到Netlify失败,从日志来看,这可能是我的parcel.js设置。日志中的错误是:

12:19:29 AM: Error running command: Build script returned non-zero exit code: 127
12:19:29 AM: Failing build: Failed to build site
12:19:29 AM: failed during stage 'building site': Build script returned non-zero exit code: 127
12:19:29 AM: Finished processing build request in 21.32707912s

我在Netlify上的部署设置是:

  

基本目录:Not set

     

构建命令:parcel build index.html

     

发布目录dist

已经搜索了类似的问题,我认为这可能是依赖性问题,但是,在使用“ Yarn”安装依赖性后,我仍然遇到相同的问题。

package.json

{
  "name": "ed",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "fullpage.js": "^3.0.5"
  },
  "devDependencies": {
    "cssnano": "^4.1.10"
  }
}

下面是文件结构,对于解决此问题的任何帮助将不胜感激。

enter image description here

1 个答案:

答案 0 :(得分:0)

您应该将parcel-bundler添加为项目的devDependencies

yarn add -D parcel-bundler

# or

npm install -D parcel-bundler

然后在您的package.json中输入构建命令

{
  "scripts": {
    "build": "parcel build index.html"
  }
}

将netlify Build命令更新为

yarn build