env: node\r: No such file or directory
Closed this issue Β· 9 comments
-
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
After generating a project, I ran npm run info
and received the following:
> typescript-starter@1.0.0 info /Users/REDACTED
> npm-scripts-info
env: node\r: No such file or directory
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! typescript-starter@1.0.0 info: `npm-scripts-info`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the typescript-starter@1.0.0 info 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! /Users/REDACTED
The same error occurs when running ./node_modules/.bin/npm-scripts-info
directly.
However, if you call it as node ./node_modules/.bin/npm-scripts-info
, it works fine.
This is obviously the same error as here so there's clearly some DOS endings instead of unix endings but I'm not sure where.
Hey @et, thanks for submitting the issue!
I'm having trouble reproducing. Could you clarify how you got there?
You ran:
npx typescript-starter
And then which options did you select?
Thanks!
Thanks for the response @bitjson. Sorry I didn't provide more detail, hopefully this helps:
β― tmp npx typescript-starter
npx: installed 353 in 18.532s
_ _ _ _ _
| |_ _ _ _ __ ___ ___ ___ _ __(_)_ __ | |_ ___| |_ __ _ _ __| |_ ___ _ __
| __| | | | '_ \ / _ \/ __|/ __| '__| | '_ \| __|____/ __| __/ _` | '__| __/ _ \ '__|
| |_| |_| | |_) | __/\__ \ (__| | | | |_) | ||_____\__ \ || (_| | | | || __/ |
\__|\__, | .__/ \___||___/\___|_| |_| .__/ \__| |___/\__\__,_|_| \__\___|_|
|___/|_| |_|
? π¦ Enter the new package name: test-test-test
? π¨ What are you making? Node.js application
? π¬ Enter the package description: This is my test
? π Will this project use npm or yarn? yarn
? π More fun stuff: Enable stricter type-checking, Enable tslint-immutable, Include VS Code debugging config
Cloning into 'test-test-test'...
remote: Counting objects: 48, done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 48 (delta 0), reused 21 (delta 0), pack-reused 0
Unpacking objects: 100% (48/48), done.
Note: checking out 'e99dd8f64e2bc1d6f446dee84d2a75e92a10ea54'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
Cloned at commit: e99dd8f64e2bc1d6f446dee84d2a75e92a10ea54
β Updating package.json
β Updating .gitignore
β Updating LICENSE
β Deleting unnecessary files
β Removing traces of the CLI
β Creating README.md
β tsconfig: don't include "dom" lib
β Initializing git repository...
Created test-test-test π
yarn install v1.5.1
info No lockfile found.
$ node -e "if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('test-test-test must be installed with Yarn: https://yarnpkg.com/')"
[1/5] π Validating package.json...
[2/5] π Resolving packages...
[3/5] π Fetching packages...
[4/5] π Linking dependencies...
warning "ava > @ava/babel-preset-stage-4 > @babel/plugin-check-constants@7.0.0-beta.38" has incorrect peer dependency "@babel/core@7.0.0-beta.38".
[5/5] π Building fresh packages...
success Saved lockfile.
β¨ Done in 23.54s.
β― tmp [1m 9s] cd test-test-test
β― test-test-test master* ls
LICENSE bin package.json tsconfig.json tslint.json
README.md node_modules src tsconfig.module.json yarn.lock
β― test-test-test master* npm run info
> typescript-starter@1.0.0 info /Users/REDACTED/tmp/test-test-test
> npm-scripts-info
env: node\r: No such file or directory
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! typescript-starter@1.0.0 info: `npm-scripts-info`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the typescript-starter@1.0.0 info 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! /Users/REDACTED/.npm/_logs/2018-03-16T01_53_12_714Z-debug.log
I also pushed up the state of the repo
Thanks for the info @et! I'll look into it a bit more. Just to clarify, what OS are you on? (I'm not seeing the issue on macOS 10.13.3.)
macOs v10.12.6
Also, I wouldn't worry about this issue too much. While nps-scripts-info
is cool, removing it doesn't break the project in anyway for me.
Btw -- I did build a node module with this (private repo) and everything else has gone swimmingly. Thanks for you work! This project was a huge time saver for me as I dip my feet into the typescript waters.
Thanks, Iβm glad youβve found it useful!
Iβll leave this issue open for now, maybe weβll get it figured out eventually.
Do you think this can be solved with a .gitattributes
that forces all files to checkout with unix line-endings? I imagine something is extracting the shebang from a script and seeing that the executable's name is node\r
, based on splitting on \n
they way bash and posix would do.
EDIT: asking @et for the output of git config --list
with personal data redacted might be helpful.
Ideally we wouldnβt need to provide such platform-specific configuration-overriding for edge cases like this. The problem isnβt specific to creating a new typescript project, itβs just a general issue for projects being contributed to by both Windows and other OS users.
The problem seems to be with the npm-scripts-info package. @et could you open up an issue there?
(I also still have no idea why I wouldnβt be able to reproduce it on macOS myself.)
I published a version of npm-scripts-info to fix this, I'll get it switched out in this project soon.