Tell us what’s happening:
Describe your issue in detail here.
In “Set up a Template Engine” section of “Advanced Node and Express” I am not able to pass the first test even though am able to pass the remaining ones.
I keep getting the error “Pug should be a dependency. (Test timed out)” or “Pug should be a dependency.” even though I have added it correctly as a dependency
"devDependencies": { "nodemon": "^2.0.4", "pug": "^3.0.2" }
I used the command npm i --save pug@~3.0.0
on the command line to install it.
Even manually setting the dependency list to the following is not working
"devDependencies": { "nodemon": "^2.0.4", "pug": "~3.0.0" }
Your project link(s)
solution: https://replit.com/@duncanndegwa/boilerplate-advancednode
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36
Challenge: Set up a Template Engine
Link to the challenge:
"devDependencies": { "nodemon": "^2.0.4", "pug": "^3.0.2" }
Did it say “dependency” or “dev dependency”?
Thanks kevinSmith for your reply. It says dependency. I am copy pasting the response below:
// running tests Pug should be a dependency. // tests completed
Yes, and you’ve added it to the dev dependencies… Is that what you want?
Looking at your package.json, I see:
{
// ...
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.16.1",
"mongodb": "^3.6.1"
},
// ...
"devDependencies": {
"nodemon": "^2.0.4",
"pug": "^3.0.2"
}
}
Do you see the issue?
Thanks for pointing that out. Its now working. But just out of curiosity. How do you install a package to to dependencies and not to devdependecies? I used npm install pug
and it went into devdependecies.
These should install in prod:
$ npm install ...
or
$ npm install --save-prod ...
or
$ npm install -P ...
For dev you do:
$ npm install --save-dev ...
or
$ npm install -D ...
But as with all things, don’t be afraid to to google it:
1 Like
Thank you for the clarification.