I'm sure this is very simple as I am just starting back to learn JavaScript. I understand the basics, the logic, but I've only ever done simple scripts embedded in HTML many years ago. version I get the error:
Cannot find module prompt-script
I have installed the library using the following command with only 1 warning about missing repository in the JSON.
npm install --save @types/prompt-sync
I also tried to delete the installed files and do it like:
C:\Users\Username\Project>npm install --save @types/prompt-sync
When it couldn't find the module the first time.
The script is very simple:
var prompt = require('prompt-sync')();
//
// get input from the user.
//
var n = prompt('How many more times? ');
This of course is not what I wanna write but I must have the library installed wrong since I can't find the module. Any help is greatly appreciated. I'm sure it's something really simple. Thank you
You are installing @types/prompt-sync
(the TypeScript definitions for prompt-sync
- even though you aren't using TypeScript) but requiring prompt-sync
.
You have to install the package you are actually requiring, prompt-sync
:
npm i prompt-sync
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.