Topic: Guide to uploading an existing NodeJS project?
Expected behavior
Execute the below and upload an existing NodeJS project:
mdb backend publish -p node12
Selecting "npm" option
Actual behavior
Publish command fails with:
Warning This is not MDB JARV project and there is no guarantee that it will work properly after publishing. In case of problems, please write to our support https://mdbootstrap.com/support/.
Success Project built successfully
Error Could not publish: Internal Server Error
Files are uploaded, copying exact folder structure, with empty node_modules folder and ENOENT errors. e.g.:
npm WARN tar ENOENT: no such file or directory, open '/home/node/code/node_modules/.staging/underscore-dc782951/amd/without.js' npm WARN tar ENOENT: no such file or directory, open '/home/node/code/node_modules/.staging/underscore-dc782951/modules/without.js' npm WARN tar ENOENT: no such file or directory, open '/home/node/code/node_modules/.staging/underscore-dc782951/amd/wrap.js' npm WARN tar ENOENT: no such file or directory, open '/home/node/code/node_modules/.staging/underscore-dc782951/modules/wrap.js' npm WARN tar ENOENT: no such file or directory, open '/home/node/code/node_modules/.staging/underscore-dc782951/amd/zip.js' npm WARN tar ENOENT: no such file or directory, open '/home/node/code/node_modules/.staging/underscore-dc782951/modules/zip.js'
Resources (screenshots, code snippets etc.)
Folder structure as follows:
- project directory
- package.json
- pakcage-lock.json
- node_modules
- ...many folders
- src
- project folders with root index.js
- dist // (build output directory)
Katarzyna Pietroń staff pro premium priority answered 3 years ago
Hi,
I see you want to publish a project written with TS. Try to build the project and run command
mdb backend publish -p node12
from inside the dist/ directory.
It is important that the root of the project contains index.js and package.json files and that the project runs on port 3000.
To avoid errors when re-publishing, delete the previous one with the command
mdb backend delete
Let me know if that helps.
Andrei S commented 3 years ago
Thank you Katarzyna. I am unable to delete as per issue.
And I am not able to re-deploy as Error The project name is already taken by one of your other projects. Please choose a different name.
Sebastian Kaczmarek staff pro premium commented 3 years ago
@Andrei S I've answered you there - the issue should not occur anymore for you.
mrbee commented 3 years ago
@Katarzyna Pietroń Do you have any documentation on additional details. This approach doesnt seem to resolve my issues
Katarzyna Pietroń staff pro premium priority commented 3 years ago
@mrbee documentation can be found at the links below https://mdbootstrap.com/docs/standard/cli/reference/ https://mdbootstrap.com/docs/standard/cli/backend/ If you do not find a solution, please provide details of your problem.
mrbee commented 3 years ago
Thanks @Katarzyna Pietroń! I figured the issue was actually that the package-lock.json cannot be included.
For future readers, your built output folder must look like:
- index.js
- package.json
- src (dir)
You must also run the publish command from inside this folder.
e.g.
cd dist && mdb backend publish -p node12 -n project-name && cd ..
Thanks!
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Free
- Premium support: No
- Technology: MDB CLI / MDB GO
- MDB Version: 3.4.0
- Device: Macbook Pro
- Browser: Chrome 90
- OS: Big Sur 11.3.1
- Provided sample code: No
- Provided link: Yes