Guide to uploading an existing NodeJS project?


Topic: Guide to uploading an existing NodeJS project?

Andrei S asked a year ago

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 answered a year 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 a year 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 a year ago

@Andrei S I've answered you there - the issue should not occur anymore for you.


mrbee commented a year ago

@Katarzyna Pietroń Do you have any documentation on additional details. This approach doesnt seem to resolve my issues


Katarzyna Pietroń staff commented a year 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 a year 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!


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • 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