npm ERR! Invalid version: y

3.8k views Asked by At

I have installed nodejs on windows 7 using the msi file at https://nodejs.org/en/download/ with node: v6.11.3 (includes npm 3.10.10)

Trying to run my app with

npm start

I get the error

D:\dev_projects\nodejs_apps\react-practice>npm start
npm ERR! Windows_NT 6.1.7600
npm ERR! argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin       \\npm-cli.js" "start"
npm ERR! node v6.11.3
npm ERR! npm  v3.10.10

npm ERR! Invalid version: "y"
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     D:\dev_projects\nodejs_apps\react-practice\npm-debug.log

The file at D:\dev_projects\nodejs_apps\react-practice\npm-debug.log contains:

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\nodejs\\node.exe',
1 verbose cli   'D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Invalid version: "y"
4 verbose stack     at Object.fixVersionField (D:\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:191:13)
4 verbose stack     at D:\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:32:38
4 verbose stack     at Array.forEach (native)
4 verbose stack     at normalize (D:\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:31:15)
4 verbose stack     at final (D:\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:349:5)
4 verbose stack     at then (D:\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:124:5)
4 verbose stack     at ReadFileContext.<anonymous> (D:\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:308:29)
4 verbose stack     at ReadFileContext.callback (D:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
4 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:367:13)
5 verbose cwd D:\dev_projects\nodejs_apps\react-practice
6 error Windows_NT 6.1.7600
7 error argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
8 error node v6.11.3
9 error npm  v3.10.10
10 error Invalid version: "y"
11 error If you need help, you may report this error at:
11 error     <https://github.com/npm/npm/issues>
12 verbose exit [ 1, true ]

I then upgrade npm to the using npm install -g npm to version 5.4.2

I run npm start again and This seems to have solved npm ERR! Windows_NT 6.1.7600 error but the error npm ERR! Invalid version: "y" is persistent:

D:\dev_projects\nodejs_apps\react-practice>npm start
npm ERR! Invalid version: "y"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\repair\AppData\Roaming\npm-cache\_logs  \2017-09-17T10_53_27_236Z-debug.log

the above 2017-09-17T10_53_27_236Z-debug.log-debug.log file contains the following:

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\repair\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Invalid version: "y"
4 verbose stack     at Object.fixVersionField (C:\Users\repair\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:191:13)
4 verbose stack     at C:\Users\repair\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:32:38
4 verbose stack     at Array.forEach (native)
4 verbose stack     at normalize (C:\Users\repair\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:31:15)
4 verbose stack     at final (C:\Users\repair\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:395:5)
4 verbose stack     at then (C:\Users\repair\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:160:5)
4 verbose stack     at C:\Users\repair\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:280:12
4 verbose stack     at C:\Users\repair\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16
4 verbose stack     at tryToString (fs.js:457:3)
4 verbose stack     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:444:12)
5 verbose cwd D:\dev_projects\nodejs_apps\react-practice
6 verbose Windows_NT 6.1.7600
7 verbose argv "D:\\nodejs\\node.exe" "C:\\Users\\repair\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
8 verbose node v6.11.3
9 verbose npm  v5.4.2
10 error Invalid version: "y"
11 verbose exit [ 1, true ]

So upgrading npm doesn't seem to solve this problem A quick google search: npm ERR! Invalid version: "y" returns solutions related to matching npm version number with semver rules.

1

There are 1 answers

1
Richard Sperry On

My package.Json had "version": "0" and needed to be "version": "0.0.1"