Jnchi / cookiecutter-nodejs-cli

Create cross-platform command-line interface (CLI), programs in Node.js on the fly.
The Unlicense
1 stars 0 forks source link

Error: Cannot find module 'yargs' #1

Open Jnchi opened 5 years ago

Jnchi commented 5 years ago
cookiecutter cookiecutter-nodejs-cli/
project_name []: testing
description []: testing
repo_name []: testing
repo_owner []: testing
directory_name []: testing
file_name []: testing
version []: 0.1
open_source_license []: BSD

ls
cookiecutter-nodejs-cli  testing

cd testing/

ls
README.md  package.json  testing.js

npm install package.json
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN Invalid version: "0.1"
npm WARN testing No description
npm WARN testing No repository field.
npm WARN testing No README data
npm WARN testing No license field.

ls
README.md  node_modules  package-lock.json  package.json  testing.js

+ package.json@2.0.1
added 74 packages from 36 contributors and audited 162 packages in 5.875s
found 0 vulnerabilities

./testing.js
internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module 'yargs'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/src/client/tmp/testing/testing.js:3:14)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
Jnchi commented 5 years ago

Requires "yargs": "11.0.0" as specified in package.json.

However, manually installing yield the following.

npm install yargs
npm WARN Invalid version: "0.1"
npm WARN testing No description
npm WARN testing No repository field.
npm WARN testing No README data
npm WARN testing No license field.

+ yargs@13.2.4
added 51 packages from 15 contributors and audited 712 packages in 3.119s
found 0 vulnerabilities

./testing.js
Usage:  node testing.js (Options) (Required)
         Options:
                --help | Display this help text
                --optional | Optional argument
                Required:
                --required | Required argument