Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Deploy Now fails #41

Closed
tloriato opened this issue Oct 18, 2019 · 11 comments
Closed

Deploy Now fails #41

tloriato opened this issue Oct 18, 2019 · 11 comments

Comments

@tloriato
Copy link

Deploy is failing on Now

@MuddyBootsCode
Copy link
Contributor

Have any logs? Error messages?

@james-cohen
Copy link

Also having the same issue. Builds fine for local host but repeatedly get the following error log when trying to deploy on Now:

18:59:49.561
Downloading 16 deployment files...
18:59:50.488
Installing build runtime...
18:59:50.962
Build runtime installed: 474.353ms
18:59:51.300
Looking up build cache...
18:59:51.330
Build cache not found
18:59:51.671
Installing dependencies...
19:00:01.930

husky@1.3.1 install /zeit/1b71e73a/node_modules/husky
19:00:01.930
node husky install
19:00:02.038
husky > setting up git hooks
19:00:02.040
Can't find .git, skipping Git hooks installation.
19:00:02.040
Please check that you're in a cloned repository or run 'git init' to create an empty Git repository and reinstall husky.
19:00:02.075
core-js@2.6.11 postinstall /zeit/1b71e73a/node_modules/@babel/runtime-corejs2/node_modules/core-js
19:00:02.075
node -e "try{require('./postinstall')}catch(e){}"
19:00:02.127
�[96mThank you for using core-js (�[94m https://github.com/zloirock/core-js �[96m) for polyfilling JavaScript standard library!�[0m
19:00:02.127
�[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: �[0m
19:00:02.127
�[96m>�[94m https://opencollective.com/core-js �[0m
19:00:02.127
�[96m>�[94m https://www.patreon.com/zloirock �[0m
19:00:02.127
�[96mAlso, the author of core-js (�[94m https://github.com/zloirock �[96m) is looking for a good job -)�[0m
19:00:02.146
core-js@3.2.1 postinstall /zeit/1b71e73a/node_modules/core-js
19:00:02.146
node scripts/postinstall || echo "ignore"
19:00:02.195
�[96mThank you for using core-js (�[94m https://github.com/zloirock/core-js �[96m) for polyfilling JavaScript standard library!�[0m
19:00:02.195
�[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: �[0m
19:00:02.195
�[96m>�[94m https://opencollective.com/core-js �[0m
19:00:02.195
�[96m>�[94m https://www.patreon.com/zloirock �[0m
19:00:02.195
�[96mAlso, the author of core-js (�[94m https://github.com/zloirock �[96m) is looking for a good job -)�[0m
19:00:02.242
protobufjs@6.8.8 postinstall /zeit/1b71e73a/node_modules/protobufjs
19:00:02.242
node scripts/postinstall
19:00:02.352
nodemon@1.19.1 postinstall /zeit/1b71e73a/node_modules/nodemon
19:00:02.352
node bin/postinstall || exit 0
19:00:02.422
�[32mLove nodemon? You can now support the project via the open collective:�[22m�[39m
19:00:02.422
�[96m�[1mhttps://opencollective.com/nodemon/donate�[0m
19:00:02.916
npm WARN grand-stack-starter-api@0.0.1 No repository field.
19:00:02.916
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
19:00:02.917
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
19:00:02.917
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/nodemon/node_modules/fsevents):
19:00:02.917
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
19:00:02.920
added 790 packages from 421 contributors in 10.905s
19:00:03.210
1 package is looking for funding
19:00:03.210
run npm fund for details
19:00:03.234
Running "npm run now-build"
19:00:03.419
grand-stack-starter-api@0.0.1 now-build /zeit/1b71e73a
19:00:03.419
babel src -d build && shx cp .env build && shx cp src/schema.graphql build
19:00:03.721
src/graphql-schema.js -> build/graphql-schema.js
19:00:03.744
src/index.js -> build/index.js
19:00:03.761
src/seed/seed-db.js -> build/seed/seed-db.js
19:00:03.776
src/seed/seed-mutations.js -> build/seed/seed-mutations.js
19:00:03.855
cp: no such file or directory: .env
19:00:03.859
npm ERR! code ELIFECYCLE
19:00:03.860
npm ERR! errno 1
19:00:03.860
npm ERR! grand-stack-starter-api@0.0.1 now-build: babel src -d build && shx cp .env build && shx cp src/schema.graphql build
19:00:03.860
npm ERR! Exit status 1
19:00:03.861
npm ERR!
19:00:03.861
npm ERR! Failed at the grand-stack-starter-api@0.0.1 now-build script.
19:00:03.861
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
19:00:03.865
npm ERR! A complete log of this run can be found in:
19:00:03.865
npm ERR! /zeit/.npm/_logs/2020-03-17T02_00_03_861Z-debug.log
19:00:03.876
Error: Exited with 1
19:00:03.876
at ChildProcess. (/zeit/ab5350c9de262234/.build-utils/.builder/node_modules/@now/static-build/dist/index.js:33891:24)
19:00:03.876
at ChildProcess.emit (events.js:223:5)
19:00:03.876
at ChildProcess.EventEmitter.emit (domain.js:475:20)
19:00:03.876
at maybeClose (internal/child_process.js:1021:16)
19:00:03.876
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
19:00:03.967
worker exited with code 20 and signal null
19:00:05.279
Done with "package.json"

Looked everywhere and can't find a fix so if anyone can help would be very grateful.

@MattGyverLee
Copy link
Contributor

MattGyverLee commented Mar 21, 2020

I would really like to be able to deploy this to see what I am missing in my own project. Looking above, @james-cohen is getting the same error I was, and it happens whether or not you have committed your .env file to GIT (and typically, you shouldn't).

see vercel/vercel#2527

cp: no such file or directory: .env

I couldn't figure out why Zeit was running build instead of now-build, or why zeit was expecting a .env file in the repo.

I ended up working around this by removing the copy env command from build, and creating a "local-build" option that had it.

@debugpoint136
Copy link

@MattGyverLee can you elaborate on how you did the "local-build" option?

@MattGyverLee
Copy link
Contributor

MattGyverLee commented Apr 1, 2020

@MattGyverLee can you elaborate on how you did the "local-build" option?

TL;DR _ _
Initially, I suspected Now was using "build" instead of "now-build", so i copied "build" in package.json to "local-build" and removed the copying of .env from "build" and "now-build". Then I worked with now-dotenv https://www.npmjs.com/package/now-dotenv to copy my production env variables to zeit. (Note: now-dotenv still requires a name value in now.json which is now deprecated)
_ _

Looking for a minimal fix to the template, it turned out to be simpler than that as now was using now-build, so I submitted the pull request #58 with a fix. You need to fill in your now.json with @ variables and update Zeit's secrets with everything you might need (client and server) since .env is no longer copied to Zeit.

The package.json now has:

"build": "babel src -d build && shx cp .env build && shx cp src/schema.graphql build",
"now-build": "babel src -d build && shx cp src/schema.graphql build",

And now.json has all my secrets, client and server.

I realize the world fell apart in the meantime (I successfully presented my prototype based on grandstack last week to my team via Zeit Now with my fix), but so far no traction on my pull request.

@MattGyverLee
Copy link
Contributor

@johnymontana Can we close this based on #58 ?

@tloriato tloriato closed this as completed Apr 7, 2020
@jonomacx
Copy link

jonomacx commented May 3, 2020

@MattGyverLee
Hi, beginner here, I was also encountering the above issue, I've updated the package.json with your new now-build line, updated the now.json file with the neo4j URI, user and password details, however I'm unsure what secrets I am to include?

The build process has now moved on from the error above to reporting Missing Public Folder (I had ran now from the api directory as per Will Lyons youtube video). If I remove the now.json file and redeploy, should I override the "Output Directory" to prevent it defaulting to Public, or will the issue be resolved with the correct secrets listed?
Thank you for any help!

@MattGyverLee
Copy link
Contributor

My edits have been merged into the main branch, so the template should build properly locally or with Now if the secrets are set. See package.json and now.json after #58 and compare it to what you have.
I'm no expert here, but I believe the API doesn't need a Public folder, and UI-React contains one. You need to run both the API and one of the clients to use the system. I haven't tested the Angular UI, so I know nothing about it.

As far as secrets, anything needed in your .env files must now be mentioned in your now.json, either given explicitly as in the paths, or by configuring Now secrets for secret credentials. At minimum you need to teach Now the secrets below to run the starter...basically anything in your now.json that is not included explicitly.
NEO4J_URI
NEO4J_USER
NEO4J_PASSWORD

Now seems to be encouraging the structure with an API folder and a UI folder now, just like the template. If build is complaining about missing folders, Without seeing your code, I don't think your current problem is related to secrets, it sounds more like a package.json config issue and a missing folder.

@jonomacx
Copy link

jonomacx commented May 4, 2020

Thank you for following up so promptly. I've re-downloaded and started from scratch and still encountering the same issue with Vercel/Now. Think I will skip this hosting part and carry on learning the graphql and react ui bits which is what I came here for anyway!

@jonomacx
Copy link

jonomacx commented May 5, 2020

If anyone else is reading this:
Reason for failure was because I was following Wills youtube video step by step. He had deployed the API piece to Now, (which is where it was failing for me), but I hadn't followed the video to the natural end where he also deploys the UI piece to Now as well.

@MattGyverLee
Copy link
Contributor

MattGyverLee commented May 6, 2020

@jonomacx Yes, I followed both, and there is a significant divergence between the video and the starter.
This video was helpful for me: https://www.youtube.com/watch?v=pRbQcy9f5ew&t=383s

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

No branches or pull requests

6 participants