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

npm install fails #1

Closed
giuliohome opened this issue Nov 12, 2021 · 6 comments
Closed

npm install fails #1

giuliohome opened this issue Nov 12, 2021 · 6 comments

Comments

@giuliohome
Copy link

General goal

I'm trying to achieve what I'vev described here.

Prerequisites

Installed the latest python version and desktop dev with C++ for VS 2019.

Install issue

Getting the following error log

249 info run @simonbuchan/users@0.1.0 install { code: 1, signal: null }
250 timing reify:rollback:createSparse Completed in 83ms
251 timing reify:rollback:retireShallow Completed in 0ms
252 timing command:install Completed in 13981ms
253 verbose stack Error: command failed
253 verbose stack     at ChildProcess.<anonymous> (C:\Users\myuser\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
253 verbose stack     at ChildProcess.emit (node:events:390:28)
253 verbose stack     at maybeClose (node:internal/child_process:1064:16)
253 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
254 verbose pkgid @simonbuchan/users@0.1.0
255 verbose cwd F:\Apps\ng\angular-sso-example\back
256 verbose Windows_NT 10.0.17763
257 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "@simonbuchan/users"
258 verbose node v16.13.0
259 verbose npm  v8.1.2
260 error code 1
261 error path F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users
262 error command failed
263 error command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
264 error Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
264 error   users.cc
264 error F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\users.cc(137,39): error C2660: 'v8::Value::Uint32Value': function does not take 0 arguments [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
264 error C:\Users\myuser\AppData\Local\node-gyp\Cache\16.13.0\include\node\v8.h(3104,41): message : see declaration of 'v8::Value::Uint32Value' [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
264 error F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\users.cc(144,29): error C3536: 'flags': cannot be used before it is initialized [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
264 error F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\users.cc(268,38): error C2660: 'v8::Value::Uint32Value': function does not take 0 arguments [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
264 error C:\Users\myuser\AppData\Local\node-gyp\Cache\16.13.0\include\node\v8.h(3104,41): message : see declaration of 'v8::Value::Uint32Value' [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
264 error F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\users.cc(269,42): error C2660: 'v8::Value::Uint32Value': function does not take 0 arguments [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
264 error C:\Users\myuser\AppData\Local\node-gyp\Cache\16.13.0\include\node\v8.h(3104,41): message : see declaration of 'v8::Value::Uint32Value' [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
264 error F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\users.cc(277,13): error C3536: 'type': cannot be used before it is initialized [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
264 error F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\users.cc(278,17): error C3536: 'provider': cannot be used before it is initialized [F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users\build\users.vcxproj]
265 error gyp info it worked if it ends with ok
265 error gyp info using node-gyp@8.3.0
265 error gyp info using node@16.13.0 | win32 | x64
265 error gyp info find Python using Python version 3.10.0 found at "C:\Users\myuser\AppData\Local\Programs\Python\Python310\python.exe"
265 error gyp info find VS using VS2019 (16.11.31729.503) found at:
265 error gyp info find VS "F:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
265 error gyp info find VS run with --verbose for detailed information
265 error gyp info spawn C:\Users\myuser\AppData\Local\Programs\Python\Python310\python.exe
265 error gyp info spawn args [
265 error gyp info spawn args   'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
265 error gyp info spawn args   'binding.gyp',
265 error gyp info spawn args   '-f',
265 error gyp info spawn args   'msvs',
265 error gyp info spawn args   '-I',
265 error gyp info spawn args   'F:\\Apps\\ng\\angular-sso-example\\back\\node_modules\\@simonbuchan\\users\\build\\config.gypi',
265 error gyp info spawn args   '-I',
265 error gyp info spawn args   'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
265 error gyp info spawn args   '-I',
265 error gyp info spawn args   'C:\\Users\\myuser\\AppData\\Local\\node-gyp\\Cache\\16.13.0\\include\\node\\common.gypi',
265 error gyp info spawn args   '-Dlibrary=shared_library',
265 error gyp info spawn args   '-Dvisibility=default',
265 error gyp info spawn args   '-Dnode_root_dir=C:\\Users\\myuser\\AppData\\Local\\node-gyp\\Cache\\16.13.0',
265 error gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
265 error gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\myuser\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.13.0\\\\<(target_arch)\\\\node.lib',
265 error gyp info spawn args   '-Dmodule_root_dir=F:\\Apps\\ng\\angular-sso-example\\back\\node_modules\\@simonbuchan\\users',
265 error gyp info spawn args   '-Dnode_engine=v8',
265 error gyp info spawn args   '--depth=.',
265 error gyp info spawn args   '--no-parallel',
265 error gyp info spawn args   '--generator-output',
265 error gyp info spawn args   'F:\\Apps\\ng\\angular-sso-example\\back\\node_modules\\@simonbuchan\\users\\build',
265 error gyp info spawn args   '-Goutput_dir=.'
265 error gyp info spawn args ]
265 error gyp info spawn F:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
265 error gyp info spawn args [
265 error gyp info spawn args   'build/binding.sln',
265 error gyp info spawn args   '/clp:Verbosity=minimal',
265 error gyp info spawn args   '/nologo',
265 error gyp info spawn args   '/p:Configuration=Release;Platform=x64'
265 error gyp info spawn args ]
265 error gyp ERR! build error
265 error gyp ERR! stack Error: `F:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
265 error gyp ERR! stack     at ChildProcess.onExit (C:\Users\myuser\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
265 error gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
265 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
265 error gyp ERR! System Windows_NT 10.0.17763
265 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
265 error gyp ERR! cwd F:\Apps\ng\angular-sso-example\back\node_modules\@simonbuchan\users
265 error gyp ERR! node -v v16.13.0
265 error gyp ERR! node-gyp -v v8.3.0
265 error gyp ERR! not ok
@giuliohome
Copy link
Author

giuliohome commented Nov 12, 2021

Now I try to clone the repository and build it from source rather than running npm i @simonbuchan/users...

Indeed it is required a

node-gyp configure

before

npm run build

@giuliohome
Copy link
Author

OK finally installed using the path to the cloned repo and all through an admin cmd.

@giuliohome
Copy link
Author

Still not working on the target repository, not sure why....

F:\Apps\ng\angular-sso-example\back>node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.0
gyp info using node@16.13.0 | win32 | x64
gyp info find Python using Python version 3.10.0 found at "F:\Program Files\Python\Python310\python.exe"
gyp info find VS using VS2019 (16.11.31729.503) found at:
gyp info find VS "F:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn F:\Program Files\Python\Python310\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'F:\\Apps\\ng\\angular-sso-example\\back\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\myuser\\AppData\\Local\\node-gyp\\Cache\\16.13.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\myuser\\AppData\\Local\\node-gyp\\Cache\\16.13.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\myuser\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.13.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=F:\\Apps\\ng\\angular-sso-example\\back',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'F:\\Apps\\ng\\angular-sso-example\\back\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding.gyp not found (cwd: F:\Apps\ng\angular-sso-example\back) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\myuser\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:259:16)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\myuser\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd F:\Apps\ng\angular-sso-example\back
gyp ERR! node -v v16.13.0
gyp ERR! node-gyp -v v8.4.0
gyp ERR! not ok

@giuliohome giuliohome reopened this Nov 12, 2021
@giuliohome
Copy link
Author

giuliohome commented Nov 12, 2021

copied binding.gyp from the cloned repo to the target and npm i node-addon-api installed there, finally node-gyp configure done there.

Furthermore npm install searches for users.cc, so I copy it too: ok it works so.

But compilation of my target server.ts still still fails!

src/server.ts:5:29 - error TS2307: Cannot find module '@simonbuchan/users' or its corresponding type declarations.

and if I try npm i lib\native-users-node:

npm ERR! code 1
npm ERR! path F:\Apps\ng\angular-sso-example\back\lib\native-users-node
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.0 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: F:\Program Files\Python\Python310\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:397:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.17763
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "F:\\Apps\\ng\\angular-sso-example\\back\\lib\\native-users-node\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd F:\Apps\ng\angular-sso-example\back\lib\native-users-node
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

why the error?

@giuliohome
Copy link
Author

giuliohome commented Nov 12, 2021

"node-gyp": "^3.8.0", this must be upgraded, node-gyp is at 8.4.0!

Manually updated this package.json.
npm install lib/native-users-node works and it produces


  "dependencies": {
    "@simonbuchan/users": "file:lib/native-users-node",

But how do I import it from my local cloned native-users-node into my node server backend project?

import {impersonateLoggedOnUser, revertToSelf} from '@simonbuchan/users';
or
import {impersonateLoggedOnUser, revertToSelf} from 'lib/native-users-node';

does not npm run compile :

error TS2307: Cannot find module '@simonbuchan/users' or its corresponding type declarations.
or
error TS2307: Cannot find module 'lib/native-users-node' or its corresponding type declarations.

Is it
import usernodes = require('lib/native-users-node/build/Release/users.node');
or
import usersnode = require('.\\build\\Release\\users.node');
?

No luck till now :-(

@giuliohome
Copy link
Author

giuliohome commented Nov 12, 2021

const { impersonateLoggedOnUser, revertToSelf} = require('F:\\Apps\\ng\\angular-sso-example\\back\\build\\Release\\users.node');

does compile!

Solved my issue!

giuliohome added a commit to giuliohome/native-users-node that referenced this issue Nov 12, 2021
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