"Invalid version number" error when building project with npm on Windows
See original GitHub issueI’m trying to move a project from macOS to Windows. The project uses two native modules: serialport and opencv4nodejs. Everything works fine on macOS.
When I run npm install
on Windows 10 (after having deleted the node_modules
folder and carefully followed the instructions), I get an “Invalid version number” error.
I’m using nw-gyp@3.6.3. Here is what I enter on the command line:
PS C:\Users\jpcote\Desktop\50e\package.nw> set PYTHON=C:\Python27\python.exe
PS C:\Users\jpcote\Desktop\50e\package.nw> set npm_config_target=0.27.1
PS C:\Users\jpcote\Desktop\50e\package.nw> set npm_config_arch=x64
PS C:\Users\jpcote\Desktop\50e\package.nw> set npm_config_runtime=node-webkit
PS C:\Users\jpcote\Desktop\50e\package.nw> set npm_config_build_from_source=true
PS C:\Users\jpcote\Desktop\50e\package.nw> set npm_config_node_gyp=C:\Users\jpcote\AppData\Roaming\npm\node_modules\nw-gyp\bin\nw-gyp.js
PS C:\Users\jpcote\Desktop\50e\package.nw> npm install --msvs_version=2015
Here is the output I get:
> serialport@4.0.7 install C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport
> node-pre-gyp install --fallback-to-build
node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
node-pre-gyp verb cli 'C:\\Users\\jpcote\\Desktop\\50e\\package.nw\\node_modules\\serialport\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp',
node-pre-gyp verb cli 'install',
node-pre-gyp verb cli '--fallback-to-build' ]
node-pre-gyp info using node-pre-gyp@0.6.32
node-pre-gyp info using node@9.2.1 | win32 | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport\build\Release\serialport.node" (not found)
node-pre-gyp http GET https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v59-win32-x64.tar.gz
node-pre-gyp http 404 https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.7 and node@9.2.1 (node-v59 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v59-win32-x64.tar.gz
node-pre-gyp verb command build [ 'rebuild' ]
gyp ERR! configure error
gyp ERR! stack Error: Invalid version number: undefined
gyp ERR! stack at getNodeDir (C:\Users\jpcote\AppData\Roaming\npm\node_modules\nw-gyp\lib\configure.js:73:25)
gyp ERR! stack at PythonFinder.callback (C:\Users\jpcote\AppData\Roaming\npm\node_modules\nw-gyp\lib\configure.js:45:7)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\jpcote\AppData\Roaming\npm\node_modules\nw-gyp\lib\configure.js:493:14)
gyp ERR! stack at ChildProcess.exithandler (child_process.js:264:7)
gyp ERR! stack at ChildProcess.emit (events.js:159:13)
gyp ERR! stack at maybeClose (internal/child_process.js:943:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jpcote\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\bin\\nw-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\jpcote\\Desktop\\50e\\package.nw\\node_modules\\serialport\\build\\Release\\serialport.node" "--module_name=serialport" "--module_path=C:\\Users\\jpcote\\Desktop\\50e\\package.nw\\node_modules\\serialport\\build\\Release" "--msvs_version=2015"
gyp ERR! cwd C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport
gyp ERR! node -v v9.2.1
gyp ERR! nw-gyp -v v3.6.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\jpcote\AppData\Roaming\npm\node_modules\nw-gyp\bin\nw-gyp.js configure --fallback-to-build --module=C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport\build\Release\serialport.node --module_name=serialport --module_path=C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport\build\Release --msvs_version=2015' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:159:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:943:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jpcote\\Desktop\\50e\\package.nw\\node_modules\\serialport\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport
node-pre-gyp ERR! node -v v9.2.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\jpcote\AppData\Roaming\npm\node_modules\nw-gyp\bin\nw-gyp.js configure --fallback-to-build --module=C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport\build\Release\serialport.node --module_name=serialport --module_path=C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport\build\Release --msvs_version=2015' (1)
npm WARN Error: EPERM: operation not permitted, scandir 'C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport\node_modules\node-pre-gyp\node_modules\request\node_modules\combined-stream\node_modules'
npm WARN { Error: EPERM: operation not permitted, scandir 'C:\Users\jpcote\Desktop\50e\package.nw\node_modules\serialport\node_modules\node-pre-gyp\node_modules\request\node_modules\combined-stream\node_modules'
npm WARN stack: 'Error: EPERM: operation not permitted, scandir \'C:\\Users\\jpcote\\Desktop\\50e\\package.nw\\node_modules\\serialport\\node_modules\\node-pre-gyp\\node_modules\\request\\node_modules\\combined-stream\\node_modules\'',
npm WARN errno: -4048,
npm WARN code: 'EPERM',
npm WARN syscall: 'scandir',
npm WARN path: 'C:\\Users\\jpcote\\Desktop\\50e\\package.nw\\node_modules\\serialport\\node_modules\\node-pre-gyp\\node_modules\\request\\node_modules\\combined-stream\\node_modules' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! serialport@4.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@4.0.7 install 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\jpcote\AppData\Roaming\npm-cache\_logs\2017-12-12T15_14_01_119Z-debug.log
```
Issue Analytics
- State:
- Created 6 years ago
- Comments:17 (9 by maintainers)
Top Results From Across the Web
npm install fails "invalid version" - Stack Overflow
When trying to install from the package.json, following error occurs. >npm install npm ERR!
Read more >NPM error (Invalid version) – Classima - RadiusTheme
NPM error (Invalid version) · 1. Delete “node_modules” folder (root directory) if it is there. · 2. Delete “package-lock.json” file (root ...
Read more >Common errors | npm Docs
Common errors · Errors · Broken npm installation · Random errors · No compatible version found · Permissions errors · Error: ENOENT, stat...
Read more >NuGet Package Version Reference - Microsoft Learn
Exact details on specifying version numbers and ranges for other packages upon which a NuGet package depends, and how dependencies are ...
Read more >Troubleshooting the Developer Tools
Then go to: node_modules/gulp-ttf2eot. Run this command: npm install ttf2eot@2.0.0. Error INVALID_LOGIN_ATTEMPT Invalid login attempt. This ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
wondering if this was solved? I got the same problem when compiling nodegit under nwjs 0.40.2
PS: on your last comment, you may not install
node-pre-gyp
by yourself, but it may be get installed by dependencies. That’s why Roger suggested starting with a simple bare package.json to isolate causes. At least it was never installed in our test environment trying to reproduce your issue.