My professor wants us to submit our project for our node.js app but we are not allowed to include node_modules in the submission.
When I try to run the app without the folder in there, it crashes due to missing dependencies.
Am i missing a step?
CodePudding user response:
Presumably either
- you're not supposed to use third-party dependencies in your solution (just the core Node.js modules), or
- you're not supposed to include
node_modules
in your submission (which is good practice anyway), but instead just have apackage.json
(and possibly a lockfile) so your instructor cannpm i
/yarn
to install the packages.
CodePudding user response:
When building an app that has node_modules you aren't supposed to include this anyway.
Install any node_modules that are required for your application to run and when sibmitting just leave out the node_modules folder.
Your package file will include everything that your instructor can check over or install on their end if necessary.
I found this random example on github: https://github.com/hayanisaid/nextjs-intro-example
As you can see by looking they have there package files but no node_modules, when you clone this repo you would run npm install which would create and install the packages
CodePudding user response:
package.json contains information about node modeuless.
If u deleted node modules, you just have to run npm i --save. All the dependency will be downloaded through this.
CodePudding user response:
Just use npm/yarn install if you remove the folder.