Svelte production build error : Prerendering failed with code 1 - javascript

I received a frontend for a website that I am trying to deploy. Running it locally in development mode works (npm run dev). However, now I am trying to build it for use in production (npm run build) but I am getting the following exception:
file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/core/prerender/prerender.js:50
throw new Error(format_error(details, config));
^
Error: 404 /
at file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/core/prerender/prerender.js:50:11
at save (file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/core/prerender/prerender.js:332:4)
at visit (file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/core/prerender/prerender.js:196:3)
[vite-plugin-svelte-kit] Prerendering failed with code 1
error during build:
Error: Prerendering failed with code 1
at ChildProcess.<anonymous> (file:///Users/stan/IdeaProjects/runespawn/web-frontend/node_modules/#sveltejs/kit/src/exports/vite/index.js:443:15)
at ChildProcess.emit (node:events:513:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
I have found a similar question How can I fix this error when trying to deploy my svelte app on github pages? but in this case the error actually makes it very clear what path is wrong. In my case, I have no idea how I can find the invalid path, Svelte does not tell me where it is.
I have inherited this project from a frontend developer, I am not familiar with Svelte or javascript in general. Any help to troubleshoot would be much appreciated.
Thank you :)

I had the same problem and although I don't think this an ideal solution, ignoring the prerendering errors worked. In your svelte.config.js
/** #type {import('#sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: null,
precompress: false
}),
prerender: {
onError: () => {
return "continue";
}
}
}

Related

Error when trying to run any Cypress test

I've installed Cypress according to the cypress docs. After opening Cypress and selecting a test to run, I instantly get the following error:
**Title:** Error running plugin
Message: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (C:\Users\metin\Desktop\Programming\School\Typescript\From JS to TS\cypress\plugins\index.js)
Stack trace:
Error: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (`C:\Users\metin\Desktop\Programming\School\Typescript\From JS to TS\cypress\plugins\index.js`)
at Object.get (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\errors.js:1043:15)
at EventEmitter.handleError (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\plugins\index.js:189:20)
at EventEmitter.emit (node:events:394:28)
at ChildProcess.<anonymous> (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\plugins\util.js:19:22)
at ChildProcess.emit (node:events:394:28)
at emit (node:internal/child_process:920:12)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
I've been googling for a few hours and I'm looking for help on how to resolve this issue!
Uninstall Nodejs
Download the Nodejs (Recommended For Most Users) version from the link:
https://nodejs.org/en/
Install the downloaded Nodejs
I had the same issues
in my case, this issue was related to my bitbucket.yml.file, I changed: max-time:(set time for running your tests) in my job, and everything works fine
If you're using Cucumber then review your step files in search of misspelling keywords or case sensitive typos like wHEN or thEn

Error [HPM] Error occurred while trying to proxy request / from localhost:8000 to http://localhost:4000 (ECONNREFUSED)

Developing a Gatsby App using this Starter
https://github.com/the-road-to-react-with-firebase/react-gatsby-firebase-authentication
I keep getting this HPM Error after updated my node packages when I try to visit my page after running Gatsby Develop. The project compiles successfully but then I get this error in the browser and nothing shows up.
error occurred while trying to proxy to: localhost:8000/
and this in the terminal:
error [HPM] Error occurred while trying to proxy request / from localhost:8000 to http://localhost:4000 (ECONNREFUSED
once I remove this from the
gatsby-config.js file it works and the pages generated in the browser:
module.exports = {
developMiddleware: app => {
app.use(
proxy({
target: "http://localhost:4000",
})
)
},
}
However, I then get this error in the terminal:
Error loading a result for the page query in "/404.html". The query was not run and no cached result was found.
Page not found /404.html
I want to know why isn't the Proxy working and what is the above module exports really doing anyway. I feel like this workaround I'm doing isn't good. Any help or advice would be great!!
Github Repo:
GitHub Repo for The project
That error means there's nothing running at http://localhost:4000. There seems to be a few problem with your setup:
First, your developMiddleware setup points to http://localhost:4000, but your server (server.js) by default runs at http://localhost:3000. Perhaps you forgot to startup the server, or start it up at the wrong port?
Second, if I read it correctly,in your proxy middleware, you're proxying every route to port 4000? This will render Gatsby useless. Here's an example of a better proxy setup:
module.exports = {
developMiddleware: app => {
app.use(
"/api",
proxy({
target: "http://localhost:4000",
})
)
},
}
With this, only request to localhost:8000/api will be proxied to localhost:4000.
Hope it helps!
I did have same error ECONNREFUSED while trying to debug both Angular and Node.js with VS Code and WSL2 Ubuntu-20.04 environment. Apparently that was solved by adding deprecated useWSL flag
{
"type": "node",
"request": "launch",
"name": "Launch Node Express via NPM",
"runtimeExecutable": "npm",
"useWSL": true,
"runtimeArgs": ["run-script", "node:debug"],
"port": 9229
},
I had the same error. In my case, I forgot to run npm run server first.
This will start the server.
Then run npm start in another terminal window.
npm start will call "ng serve --proxy-config ./proxy.json"
My proxy.json file:
{
"/api": {
"target": "http://localhost:9000",
"secure": false
}
}

Build of React application on AWS Amplify fails in Amplify Console

I can locally publish my application to the S3 bucket and the application works. But deployment through AWS Amplify console (web) fails on the Build step of the backend.
The build step of the backend fails because of a missing configuration file or directory.
{
Error: ENOENT: no such file or directory, scandir '/codebuild/output/src145745747/src/aws-service-catalog/amplify/backend/auth/cognito8f0f2f1d'
at Object.fs.readdirSync (fs.js:904:18)
at getCfnFiles (/root/.nvm/versions/node/v8.12.0/lib/node_modules/#aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/push-resources.js:337:20)
at updateS3Templates (/root/.nvm/versions/node/v8.12.0/lib/node_modules/#aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/push-resources.js:350:39)
at packageResources.then.then.then.then (/root/.nvm/versions/node/v8.12.0/lib/node_modules/#aws-amplify/cli/node_modules/amplify-provider-awscloudformation/lib/push-resources.js:42:17)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
errno: -2,
code: 'ENOENT',
syscall: 'scandir',
path: '/codebuild/output/src145745747/src/aws-service-catalog/amplify/backend/auth/cognito8f0f2f1d'
}
Anybody has tips how to debug/resolve this problem?
See my reply on the thread above. The directory was not included in my git repo.
It's sad that aws amplify is not showing any details on build failure even on debug mode.
The solution is recloning the app and test locally and then push the changes.
The problem happens to be Git is missing changes. This git issue is resolved by following this steps

Error with polymer build

I am triying to learn how to use the new app-toolbox. In local, works fine; but when I use:
polymer build
I get these errors:
C:\Users\Marcos\Documents\poly2>polymer build
info: Building application...
info: Generating build/unbundled...
info: Generating build/bundled...
error: Uncaught exception: Error: file path is not in root: C:/Users/Marcos/Documents/poly2/index.html (C:\Users\Marcos\Documents\poly2)
error: Error: file path is not in root: C:/Users/Marcos/Documents/poly2/index.html (C:\Users\Marcos\Documents\poly2)
at StreamAnalyzer.urlFromPath (C:\Users\Marcos\AppData\Roaming\npm\node_modules\polymer-cli\lib\build\analyzer.js:91:19)
at StreamAnalyzer.addFile (C:\Users\Marcos\AppData\Roaming\npm\node_modules\polymer-cli\lib\build\analyzer.js:81:29)
at StreamAnalyzer._transform (C:\Users\Marcos\AppData\Roaming\npm\node_modules\polymer-cli\lib\build\analyzer.js:48:14)
at StreamAnalyzer.Transform._read (_stream_transform.js:167:10)
at StreamAnalyzer.Transform._write (_stream_transform.js:155:12)
at doWrite (_stream_writable.js:301:12)
at writeOrBuffer (_stream_writable.js:287:5)
at StreamAnalyzer.Writable.write (_stream_writable.js:215:11)
at PassThrough.ondata (C:\Users\Marcos\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\readable-stream\lib_stream_readable.js:531:20)
at emitOne (events.js:95:20)
I am using Windows 10.
I got the same problem. Deleting npm-cache at C:\Users\%USER_NAME%\AppData\Roaming\npm-cache and re-installing nodejs and polymer-cli fixed this for me.
Currently, I'm using Windows 10 with nodejs v4.4.5, npm v2.15.5 and polymer-cli v0.11.0 (I notice that they've just updated polymer-cli from v0.10.0 to v0.11.0)
Hope this help.

Meteor: Error: ENOTEMPTY: directory not empty when deploying to Modulus

I'm deploying a Meteor app to Modulus.io. I had no problems at all deploying it with modulus deploy in the last couple of days but after a couple of changes to my app I now get the following error:
Error: ENOTEMPTY: directory not empty
It happens at a very late stage of their script, here's the full log from the terminal:
deploy -> v0.10.36
Uploading completed build.
Provisioning and deploying bundle to servos...
fs.js:807
return binding.rmdir(pathModule._makeLong(path));
^
Error: ENOTEMPTY: directory not empty, rmdir '/Users/andreaswest/Documents/workspace/test2/.demeteorized'
at Error (native)
at Object.fs.rmdirSync (fs.js:807:18)
at Object.removeSync (/usr/local/lib/node_modules/modulus/node_modules/fs-tools/lib/fs-tools.js:420:8)
at /usr/local/lib/node_modules/modulus/lib/controllers/project.js:279:21
at /usr/local/lib/node_modules/modulus/lib/controllers/project.js:383:19
at /usr/local/lib/node_modules/modulus/lib/controllers/project.js:354:9
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/modulus/lib/librarian/http.js:134:9)
at emitNone (events.js:73:20)
at IncomingMessage.emit (events.js:167:7)
at endReadableNT (_stream_readable.js:906:12)
Can anyone help?
This is the answer I got from David Berger from Modulus support:
Hey Andreas,
Sometimes this will happen and the deploy will have been successful, but the CLI failed to do a little cleanup afterwards. If your deploy is not working from the CLI, we recommend trying to deploy from the web dashboard: https://my.modulus.io/project/57316
If you deploy from the web dashboard, create a zip of your project files, and then upload it via the ‘deploy files’ upload in the upper right hand corner of the dashboard.

Categories