Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run build failed after beta.20 to 3.0.0 migration #6654

Closed
demobo-com opened this issue Jun 12, 2020 · 11 comments
Closed

npm run build failed after beta.20 to 3.0.0 migration #6654

demobo-com opened this issue Jun 12, 2020 · 11 comments

Comments

@demobo-com
Copy link

demobo-com commented Jun 12, 2020

Describe the bug
npm run build
Failed after beta.20 to 3.0.0 migration

Steps to reproduce the behavior

  1. Follow migration instruction https://strapi.io/documentation/v3.x/migration-guide/migration-guide-beta.20-to-3.0.0.html
  2. npm run build
  3. See the following error

Error while running command build: undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! strapi-app@0.1.0 build: strapi build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the strapi-app@0.1.0 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/jlin/.npm/_logs/2020-06-12T22_17_13_223Z-debug.log

Expected behavior
build succeed

Screenshots
If applicable, add screenshots to help explain your problem.

Code snippets
If applicable, add code samples to help explain your problem.

System

  • Node.js version: v12.14.1
  • NPM version: 6.13.4
  • Strapi version: 3.0.0
  • Database: mongo
  • Operating system: Mac OS

Additional context
Add any other context about the problem here.

@derrickmehaffy
Copy link
Member

We need more information as to the actual error, do you have a link to your project code somewhere like Github or Gitlab?

@DarkTraveler
Copy link

Hi.
You tried npm i -g strapi?
Also try using yarn instead of npm

@demobo-com
Copy link
Author

npm i -g strapi
strapi -v
3.0.1
I do have the latest strapi globally.

Still no luck
npm run build
Error while running command build: undefined

@iCarossio
Copy link

iCarossio commented Jun 14, 2020

Hello @demobo-com . I think I have the same problem as yours (check #6659). I tried a lot of things as you can see in my ticket but none of them worked. I cannot reproduce the issue in a freshly build project.
Thank you!


Edit I've found a solution that worked for me: #6659

@demobo-com
Copy link
Author

@iCarossio git clone does not work for me.
Still getting "Error while running command build: undefined" after "npm run build"

Roll back to 3.0.0-beta.20 then it is working again.

Migration:

  1. Replace "3.0.0-beta.20" to "3.0.0"
  2. Change /config files
  3. Change database lifecycles
  4. npm i (This is ok)
  5. npm run build (Error while running command build: undefined)

Here is my package.json
{ "name": "strapi-app", "private": true, "version": "0.1.0", "description": "A Strapi application.", "main": "./server.js", "scripts": { "develop": "strapi develop", "start": "strapi start", "build": "strapi build", "strapi": "strapi" }, "devDependencies": { "babel-eslint": "^7.1.1", "eslint": "^4.19.1", "eslint-config-airbnb": "^13.0.0", "eslint-plugin-import": "^2.11.0", "eslint-plugin-react": "^7.7.0" }, "dependencies": { "atob": "^2.1.2", "btoa": "^1.2.1", "cheerio": "^1.0.0-rc.3", "cookie": "^0.4.0", "csvtojson": "^2.0.10", "datauri": "^2.0.0", "es6-promisify": "^6.0.2", "firebase-admin": "^6.4.0", "google-libphonenumber": "^3.2.2", "google-search": "0.0.5", "googleapis": "^47.0.0", "js-base64": "^2.5.1", "json2csv": "^5.0.1", "jsonwebtoken": "^8.5.1", "load-json-file": "^6.0.0", "lodash": "^4.17.5", "lru-cache": "^5.1.1", "mailparser": "^2.7.7", "moment": "^2.24.0", "mysql2": "^1.6.5", "node-fetch": "^2.6.0", "node-gcp": "^0.2.1", "node-geocoder": "^3.23.0", "node-gmail-api": "^0.6.1", "nodemailer": "^6.4.6", "numeral": "^2.0.6", "passport": "^0.4.1", "passport-google-oauth": "^2.0.0", "pdf-parse": "^1.1.1", "query-string": "^6.8.2", "request-promise": "^4.2.5", "request-promise-native": "^1.0.7", "sharp": "^0.25.3", "socket.io": "^2.2.0", "strapi": "3.0.0-beta.20", "strapi-admin": "3.0.0-beta.20", "strapi-connector-bookshelf": "3.0.0-beta.20", "strapi-connector-mongoose": "3.0.0-beta.20", "strapi-plugin-content-manager": "3.0.0-beta.20", "strapi-plugin-content-type-builder": "3.0.0-beta.20", "strapi-plugin-email": "3.0.0-beta.20", "strapi-plugin-upload": "3.0.0-beta.20", "strapi-plugin-users-permissions": "3.0.0-beta.20", "strapi-utils": "3.0.0-beta.20", "strapi-provider-upload-aws-s3": "3.0.0-beta.20" }, "author": { "name": "A Strapi developer", "email": "", "url": "" }, "maintainers": [ { "name": "A Strapi developer", "email": "", "url": "" } ], "strapi": { "uuid": "3542988a-4597-404a-ab5c-29d561d9f1e5" }, "engines": { "node": ">= 10.0.0", "npm": ">= 6.0.0" }, "license": "MIT" }

@DarkTraveler
Copy link

@demobo-com
Have you tried to remove .cache .build node_modules completely?
I am using WSL2, Ubuntu 20, strapi is installed globally npm i -g strapi.

I did not observe such a problem during the migration of my project. The only thing I deleted the config folder and took from a new project.

If only strapi did not have an allergy to macOs :)

I also recommend using yarn instead of npm, I have had occasions when building through npm failed.

@DarkTraveler
Copy link

P.s. Try upgrading strapi to beta.20.3 first

@hendrikgaffo
Copy link

@demobo-com Do you have any updates on this? I am getting the same error with system specs similar to yours (Ubuntu instead of macOS).
Unfortunately the workaround @iCarossio suggested did not work for me.

@kcouliba
Copy link

kcouliba commented Aug 7, 2020

Hi all, I just encountered that error today and I'd like to just share about what caused the error, and how I solved it.
In my case, I was writing a function in the function folder, and the error popped because I was using optional chaining syntax.
Going back with standard es5 solved the problem.

I didn't push the investigation way further on the reason why this is happening, and how the error message is so misleading.

Anyway, I hope that helps someone.

@tarnacious
Copy link

tarnacious commented Aug 19, 2020

I had a similar issue to this that was caused by Strapi trying to load swap files Vim was creating in the ./config/functions/ directory. This took a while to debug because the actual error was not being logged or displayed. This has recently been fixed so it displays the actual error. #7388

@derrickmehaffy
Copy link
Member

As we haven't seen any reproduction of this in the past few weeks, going to mark as closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants