feathers-plus / cli

FeathersJS CLI supporting both REST and GraphQL architectural concepts and their query languages.
https://generator.feathers-plus.com/
Other
43 stars 7 forks source link

Generated TypeScript version fails to compile due to missing typings files #6

Closed iva2k closed 6 years ago

iva2k commented 6 years ago

Using Windows7, node v8.11.2, Performed the following steps from https://generator.feathers-plus.com/get-started/

npm i -g @feathers-plus/cli
mkdir feathers-app
cd feathers-app
feathers-plus generate options
# chosen all defaults, except "Generate TypeScript code?" Yes

feathers-plus generate app
# chosen all defaults

npm start > log.start 2>&1
# -> fails

log.start:

> api@0.0.0 start C:\dev\ionic3-feathersplus-try2\api
> ts-node src/

C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:261
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/app.hooks.ts(4,30): error TS7016: Could not find a declaration file for module 'feathers-hooks-common'. 'C:/dev/ionic3-feathersplus-try2/api/node_modules/feathers-hooks-common/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/feathers-hooks-common` if it exists or add a new declaration (.d.ts) file containing `declare module 'feathers-hooks-common';`

    at createTSError (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:261:12)
    at getOutput (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:367:40)
    at Object.compile (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:557:11)
    at Module.m._compile (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:439:43)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\dev\ionic3-feathersplus-try2\api\node_modules\ts-node\src\index.ts:442:12)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! api@0.0.0 start: `ts-node src/`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the api@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\...\AppData\Roaming\npm-cache\_logs\2018-07-17T04_59_10_172Z-debug.log
j2L4e commented 6 years ago

run feathers-plus generate all to regen typings.d.ts as a workaround

scratch that, I could reproduce the problem.

j2L4e commented 6 years ago

change the npm start script to ts-node --files src/ to make it work

eddyystop commented 6 years ago

Fix pushed to GitHub.

Will be published in the next few days as @feathers-plus/cli 0.4.13.

Note the generator does not regenerate package.json other than add dependencies to it. So you will have to manually make j2L4e's change.

eddyystop commented 6 years ago

You presently still have to run generate all after any other generate to force typings.d.ts to regenerate.

eddyystop commented 6 years ago

Fix pushed to GitHub.

Fixes published as f+/cli 0.4.13.

iva2k commented 6 years ago

Thanks for the fix!