Why Every Project Starts With package.json

Your check-setup.js prints the team’s setup report. Move it into ~/onboarding-check, the project folder every new developer gets. The team wants consistent rules across the report’s files so mistakes are easier to catch. Even without dependencies, you use a package.json to explicitly make the project’s .js files ES modules.

The team’s next change stores the path to the current folder before printing it. In Python, you’d assign folder = os.getcwd(). Carry that across as folder = process.cwd();, then print it with console.log("Folder:", folder);. With no package.json in the folder or above it, those lines work. Now give the project its configuration.

Set the Module Format

Like Python’s pyproject.toml, package.json describes a project and can list dependencies. Unlike pyproject.toml, it controls how the runtime reads your source files. Create onboarding-check/package.json with this setting:

Language: JSON
{ "type": "module" }

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.