Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"type": "commonjs" is now the default in npm init #1380

Closed
webchick opened this issue Jan 7, 2025 · 0 comments · Fixed by #1381
Closed

"type": "commonjs" is now the default in npm init #1380

webchick opened this issue Jan 7, 2025 · 0 comments · Fixed by #1381

Comments

@webchick
Copy link
Contributor

webchick commented Jan 7, 2025

Hello, me again. ;) This time, I'm going through your nice https://docs.apify.com/academy/web-scraping-for-beginners/ course.

At the Setting up your project step, it contains the following directive:

"To switch to the modern version, open your package.json and add this line to the end of the JSON object. Don't forget to add a comma to the end of the previous line 😉"

However, as of NPM 11 / npm/init-package-json#313 (it seems), type is already defined. Here's the default contents of package.json after running npm init -y in 11.0.0:

{
  "name": "test",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "commonjs",
  "description": ""
}

If you follow the steps as directed, Visual Studio Code will get mad at you because there are duplicate keys:

Visual Studio Code showing two warnings in the Console due to Duplicate object key
B4nan pushed a commit that referenced this issue Jan 7, 2025
Note: There are multiple ways we could go about updating the text, but
this seemed the least invasive for now.

Closes #1380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant