Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts-node tools/init failed while initializing the project under windows 10 #300

Closed
wiekern opened this issue Jun 28, 2019 · 0 comments
Closed

Comments

@wiekern
Copy link

wiekern commented Jun 28, 2019

OS: Win 10
node: v8.15.1
npm: 6.4.1

> ts-node tools/init

Hi! You're almost ready to make the next great TypeScript library.

Would you like it to be called "typescript-axios"? [Yes/No]:  yes


Thanks for the info. The last few changes are being made... hang tight!


AzureAD\xxx

xxx@gmail.com

Removed

.git

.all-contributorsrc

.gitattributes

tools/init.ts


Modified

LICENSE

package.json

rollup.config.ts

test/library.test.ts

tools/gh-pages-publish.ts


Renamed

src/library.ts => src/typescript-axios.ts

test/library.test.ts => test/typescript-axios.test.ts



Finalizing

Initialized empty Git repository in C:/Users/xxx/Desktop/typescript-axios/.git/


C:\Users\xxx\Desktop\typescript-axios\tools\init.ts:264

  const pkg = JSON.parse(readFileSync(jsonPackage) as any)

                   ^

SyntaxError: Unexpected token Y in JSON at position 289

    at JSON.parse (<anonymous>)

    at finalize (C:\Users\xxx\Desktop\typescript-axios\tools\init.ts:264:20)

    at setupLibrary (C:\Users\xxx\Desktop\typescript-axios\tools\init.ts:183:3)

    at C:\Users\xxx\Desktop\typescript-axios\tools\init.ts:124:7

    at C:\Users\xxx\Desktop\typescript-axios\node_modules\prompt\lib\prompt.js:336:32

    at C:\Users\xxx\Desktop\typescript-axios\node_modules\utile\node_modules\async\lib\async.js:154:25

    at assembler (C:\Users\xxx\Desktop\typescript-axios\node_modules\prompt\lib\prompt.js:333:9)

    at C:\Users\xxx\Desktop\typescript-axios\node_modules\prompt\lib\prompt.js:342:32

    at C:\Users\xxx\Desktop\typescript-axios\node_modules\prompt\lib\prompt.js:625:5

    at Interface.onLine (C:\Users\xxx\Desktop\typescript-axios\node_modules\read\lib\read.js:111:5)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! --libraryname--@0.0.0 postinstall: `ts-node tools/init`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the --libraryname--@0.0.0 postinstall 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\xxx\AppData\Roaming\npm-cache\_logs\2019-06-25T19_52_31_495Z-debug.log

In this situation, the git username extracted by the command git config user.name is "
AzureAD\xxx", in which there is a prefix "AzureAD\" including a back slash. This leads to a misformed package.json file due to the back slash in the field of "author". To solve this error, you can set the git username globally by git config --global user.name "USERNAME" , then everything will be fine..

@wiekern wiekern closed this as completed Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant