Search code examples
javascriptnpmserverless-frameworkserverlessparcel

My reactjs website refuses to go in serverless when i'm executing parcel


I’ve been working on a website for some time, and I use serverless. Everything was going well, but since this morning, impossible to push my updates from my site to serverless. By pushing I have this mistake :

    Error: Failed building website via "npm run build" due to the following error: "npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `parcel build index.html`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/maxime/.npm/_logs/2019-12-04T15_03_19_978Z-debug.log
"

and the error of the _logs is:

   0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/maxime/Documents/website copie/node_modules/.bin:/Users/maxime/Library/Python/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/maxime/Library/Python/3.7/bin:/Users/maxime/anaconda3/bin:/Users/maxime/anaconda3/condabin
9 verbose lifecycle [email protected]~build: CWD: /Users/maxime/Documents/website copie
10 silly lifecycle [email protected]~build: Args: [ '-c', 'parcel build index.html' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `parcel build index.html`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/maxime/Documents/website copie
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v10.16.3
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `parcel build index.html`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I don't understand at all the error. They're saying my build is failing, but it was working yesterday and i didn't touch at all the serverless part. Has anyone ever had the same problem and could help me understand?

PS: Even using old content, cannot use serverless

Thanks you and sorry for the stupid question;

PS : my package.json

  {
  "name": "website",
  "version": "0.1.0",
  "description": "",
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html"
  },
  "license": "MIT",
  "dependencies": {
    "@material-ui/core": "^4.6.0",
    "axios": "^0.19.0",
    "browserify-fs": "^1.0.0",
    "chart.js": "^2.9.2",
    "express-basic-auth": "^1.2.0",
    "material-expansion-panel": "^1.0.0",
    "moment": "^2.24.0",
    "react": "^16.11.0",
    "react-chartjs-2": "^2.7.6",
    "react-dom": "^16.11.0",
    "react-grid-system": "^6.0.3",
    "react-history": "^0.18.2",
    "react-hook-form": "^3.27.0",
    "react-js-snackbar": "^1.0.4",
    "react-navigation": "^4.0.10",
    "react-router-dom": "^5.1.2",
    "react-skylight": "^0.5.1",
    "react-tabs": "^3.0.0",
    "react-tooltip": "^3.11.1",
    "reactstrap": "^8.1.1",
    "styled-components": "^4.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.7.2",
    "babel-preset-nano-react-app": "^0.1.0",
    "parcel-bundler": "^1.11.0",
    "parcel-plugin-clean-dist": "0.0.6"
  },
  "babel": {
    "presets": [
      "nano-react-app"
    ],
    "plugins": [
      [
        "@babel/plugin-proposal-class-properties",
        {
          "loose": true
        }
      ],
      [
        "@babel/plugin-transform-react-jsx",
        {
          "pragmaFrag": "React.Fragment"
        }
      ]
    ]
  }
}

Solution

  • So I found the error with the help of @Andrewlohr.

    Npm indicates the line where it stopped working. For me it's parcel build index.html

    To get more details about why parcel build index.html didn’t work, I simply run the command line in the console, without using npm.

      ~/D/website copie> parcel build index.html
    🚨  /Users/maxime/Documents/website copie/src/app.css:71:3: Unknown word
      69 | 
      70 | Input#ca {
    > 71 |   style="border:1px solid #ff0000"
         |   ^
      72 | }
      73 | 
    

    Parcel told me the error came from a word on my .css . To simplify, npm will just indicate where the problem comes from in the package. Do not hesitate to execute the line yourself