yarn icon indicating copy to clipboard operation
yarn copied to clipboard

error An unexpected error occurred: "Invalid number of spaces".

Open wiston-mwinzi opened this issue 6 years ago • 10 comments

Yarn version: 1.5.1

Do you want to request a feature or report a bug?

bug

What is the current behavior? error An unexpected error occurred: "Invalid number of spaces".

If the current behavior is a bug, please provide the steps to reproduce.

error during yarn install on window 10

What is the expected behavior? Install packages

Please mention your node.js, yarn and operating system version. **Yarn version: 1.5.1

Node version: 9.3.0

Platform: win32 x64**

----------------- More Info ----------- Trace: TypeError: Invalid number of spaces at tokenise (D:\Installs\Yarn\lib\cli.js:61849:17) at tokenise.next () at Parser.next (D:\Installs\Yarn\lib\cli.js:61961:28) at Parser.parse (D:\Installs\Yarn\lib\cli.js:62009:30) at parse (D:\Installs\Yarn\lib\cli.js:62182:17) at module.exports.exports.default (D:\Installs\Yarn\lib\cli.js:61746:96) at YarnRegistry. (D:\Installs\Yarn\lib\cli.js:92468:64) at Generator.next () at step (D:\Installs\Yarn\lib\cli.js:98:30) at D:\Installs\Yarn\lib\cli.js:109:13

---------------------- cli -------------------------

cli.zip

wiston-mwinzi avatar Apr 04 '18 11:04 wiston-mwinzi

You probably have an invalid lockfile or npmrc.

arcanis avatar Apr 04 '18 11:04 arcanis

What does the invalid lockfile or npmrc mean and how can i resolve this?

wiston-mwinzi avatar Apr 05 '18 08:04 wiston-mwinzi

This even happens when i do below

yarn init

I get

λ yarn init yarn init v1.5.1 error An unexpected error occurred: "Invalid number of spaces". info If you think this is a bug, please open a bug report with the information provided in "E:\PROJECTS\\myApp\yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/init for documentation about this command.

attached _yarn-error.log yarn-error.log

_

wiston-mwinzi avatar Apr 05 '18 09:04 wiston-mwinzi

I'm experiencing the same issue! Is there a fix or workaround for this?

mike2004 avatar Jul 26 '18 19:07 mike2004

I managed to get this working by deleting yarn.lock file and running yarn install

navinesh avatar Aug 27 '18 23:08 navinesh

Why can't yarn tell me which line has this problem? I get the yarn-error.log, it has the whole package.json and the whole yarn.lock file in there, but nothing about the actual error that occured.

dmt0 avatar Dec 14 '18 00:12 dmt0

I managed to get this working by deleting yarn.lock file and running yarn install

Thanks! That seem to do the trick!

jeffleu avatar Feb 24 '20 22:02 jeffleu

The issue occurs when the is some extra space in any particular line for yarn.lock file. A formatter for lock file will resolve this issue if you don't want to delete the lock file.

ab-rnjn avatar Feb 22 '21 17:02 ab-rnjn

The issue can occurs when the is some extra space in your .yarnrc file too

sammerset avatar Oct 27 '21 08:10 sammerset

@ab-rnjn do you recommend any? prettier tells me that it can't format plaintext

veniti avatar Jun 06 '22 09:06 veniti

Remove the yarn.lock and install again, it can resolve your problem.

watermirror1107 avatar Oct 18 '22 01:10 watermirror1107