Closed rxluz closed 4 years ago
got these errors too.
One have to add "node" in tsconfig.json "types": ["node"],
Hey @rxluz and @Sharlaan – I'm trying to reproduce this, here's what I'm selecting:
$ npx typescript-starter
_ _ _ _ _
| |_ _ _ _ __ ___ ___ __ _ _(_)_ __| |_ ___ __| |_ __ _ _ _| |_ ___ _ _
| _| || | '_ \/ -_|_-</ _| '_| | '_ \ _|___(_-< _/ _` | '_| _/ -_) '_|
\__|\_, | .__/\___/__/\__|_| |_| .__/\__| /__/\__\__,_|_| \__\___|_|
|__/|_| |_|
? 📦 Enter the new package name: jjjj
? 🔨 What are you making? Javascript library
? 💬 Enter the package description: lll
? 🚄 Will this project use npm or yarn? npm
? 📚 Which global type definitions do you want to include? None — the library wo
n't use any globals or modules from Node.js or the DOM
? 🚀 More fun stuff: (Press <space> to select, <a> to toggle all, <i> to invert
selection)Enable tslint-immutable, Include .editorconfig, Include VS Code debugg
ing config, Include CircleCI config
But I'm seeing 2 tests passing when I run npm run watch
. What settings are you selecting?
I see this same error when I run npm run doc
.
My settings:
? 📦 Enter the new package name: my-package
? 🔨 What are you making? Javascript library
? 💬 Enter the package description: jjjj
? 🚄 Will this project use npm or yarn? npm
? 📚 Which global type definitions do you want to include? None — the library won't use any globals or modules from Node.js or the DOM
? 🚀 More fun stuff: Enable stricter type-checking, Include .editorconfig, Include VS Code debugging config, Include Travis CI config
npm test
and npm run build
are clean.
But npm run doc
gives me
$ npm run doc
> my-project@1.0.0 doc /Users/me/projects/my-project
> run-s doc:html && open-cli build/docs/index.html
> my-project@1.0.0 doc:html /Users/me/projects/my-project
> typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --out build/docs
Using TypeScript 3.5.3 from /Users/me/projects/my-project/node_modules/@bitjson/typedoc/node_modules/typescript/lib
Error: /Users/me/projects/my-project/src/types/example.d.ts(23)
Cannot find namespace 'NodeJS'.
Error: /Users/me/projects/my-project/src/types/example.d.ts(26)
Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.
Error: /Users/me/projects/my-project/src/types/example.d.ts(29)
Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.
Looks like this error is due to including example code in src\types\example.d.ts that relies on NodeJS so it fails when you run any command that calls build.
Workaround: comment out or delete the code in example.d.ts (or as mentioned above you can add node to your project but that's kinda silly because you just told the generator you didn't want it 😆).
Repro steps:
npx typescript-starter
and choose JS library and None for global typescd my-project
npm i ava@3.8.2
and edit package.json to remove sources from ava sectionnpm run build
Really awesome app! I'm learning a lot by seeing what this can do. Thanks @bitjson!
Hey all – the latest release of typescript-starter
should solve this issue, but please let me know if you're still having trouble. 👍
I'm submitting a ... [x ] bug report [ ] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project
Summary When you select the option to create a pure javascript project without Node neither DOM and you run the initial command described in README (npm run watch) the build fails.
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)