Happydevdays Happydevdays - 1 year ago 181
JSON Question

node.js noobie trying to follow a tutorial - need to change jade reference to pug

I'm trying to follow this tutorial to learn about node.js:


When I run "npm install" some of the messages I see include this:

npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer

And then it goes ahead and seems to set up the application anyways.
My package.json file currently looks like this:

"name": "testapp",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0",
"mongodb": "^1.4.4",
"monk": "^1.0.1"

(these questions apply to both packages that I got warned about, but for discussion purposes, I'm just going to pick on jade / pug)

If I wanted to change jade to pug, do i need to specify a version number in this package.json file? Or can I just tell it to get latest somehow?
Also, do I need to blow away my folder structure and then rerun the npm install command? Or can I just edit the package.json file and retry npm install?

Lastly, based on your experience, how critical is it for me to change from jade to pug if i'm just trying to learn how node works? I'm tempted to just leave as is... but then again, if this app works, i know it's going to be rolled out into production..
so... i guess i should make the right decisions up front.

Thanks and sorry if my questions are really remedial.

Answer Source

looks like you have a few questions so I'll go through them in order. If you want to change jade to pug you can run the following from the command line:

npm uninstall jade --save


npm install pug --save 

unless you specify the version when installing by saying pug@1.1.0 for example you will get the current version. Here is the documentation for how you can specify versions in your JSON https://docs.npmjs.com/files/package.json but you can specify a specific version or a specify major or minor version. It really depends on what you want to do.

in order to remove modules that are not in your package.json file use the prune command:

npm prune

This should remove modules not listed in your json (as long as they aren't dependencies)

I believe Jade was forced to change their name in npm due to copyright issue. I think it would be a good idea to use the current name so you can stay up to date if there are changes to the package

nb:make sure to change the extension to .pug from .jade

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download