Errors building dev branch of SAFE browser

I’m currently trying to build SAFE browser including authenticator but run into several errors and the npm install command does not finish. I’m rather new to npm so these may be a noob question, but any hints are much appreciated.

Btw: I read the readme: “Note 02: Do not worry about any errors that appear.” But it won’t produce any executeables, so I can’t ignore them. :smiley:

First some warnings…

npm install
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use ‘npm ls graceful-fs’ to find it in the tree.
npm WARN prefer global node-gyp@3.6.0 should be installed with -g

electron@1.4.1 postinstall C:\Users\Alexander\projects\safe_browser\node_modules\electron
node install.js

undefined postinstall C:\Users\Alexander\projects\safe_browser
cd app && npm install && cd …/ && npm run build-safe-app

ref@1.3.4 install C:\Users\Alexander\projects\safe_browser\app\node_modules\ref
node-gyp rebuild

Then an error about Python missing, is Python required for safe_browser?

C:\Users\Alexander\projects\safe_browser\app\node_modules\ref>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\…\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node “” rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can’t find Python executable “python”, you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:454:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:480:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:114:15)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
gyp ERR! cwd C:\Users\Alexander\projects\safe_browser\app\node_modules\ref
gyp ERR! node -v v7.8.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
npm WARN safe-browser@0.4.3 No repository field.
npm WARN safe-browser@0.4.3 No license field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “install”
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! ref@1.3.4 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref@1.3.4 install script ‘node-gyp rebuild’.

And then I get undefined postinstall error (maybe due to the previous errors?):

npm ERR! Windows_NT 10.0.14393
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “install”
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! undefined postinstall: cd app && npm install && cd ../ && npm run build-safe-app
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the undefined postinstall script ‘cd app && npm install && cd …/ && npm run build-safe-app’.

After that the script stops. Do I need to clone and build authenticator manually before building safe_browser? I just cloned safe_browser and tried running the commands from the readme.

2 Likes

Let’s see if I can help you. I just figured out how to successfully compile it on Windows.

After cloning, did you switch to dev branch by running git checkout -b dev origin/dev?

Are you running in PowerShell or Command Prompt?

It looks like node-gyp uses python to sort of make files, safe browser isn’t explicitly using python. This may have to do with your environment pointing to Python 3 instead of Python 2. I’m not sure but we’ll figure it out after we make sure that the bases are covered.

2 Likes

Great to hear and thanks for your help! It had indeed to do with the wrong Python version. It seems that Python 2.7 is needed.

However, after sorting this out, I now run into another issue which seems related to my MSVC setup. I have installed MSVC build tools 2015 and configured gyp to use it. The error is:

gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ ‘build/binding.sln’,
gyp info spawn args ‘/nologo’,
gyp info spawn args ‘/p:Configuration=Release;Platform=x64’ ]
Building the projects in this solution one at a time. To enable parallel build, please add the “/m” switch.
Build started 03-Apr-17 15:16:47.
Project “C:\Users\Alexander\Projects\safe_browser\app\node_modules\ref\build\binding.sln” on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration “Release|x64”.
Project “C:\Users\Alexander\Projects\safe_browser\app\node_modules\ref\build\binding.sln” (1) is building “C:\Users\Alexander\Projects\safe_browser\app\node_modules\ref\build\binding.vcxproj” (2) on node 1 (default targets).
C:\Users\Alexander\Projects\safe_browser\app\node_modules\ref\build\binding.vcxproj(20,3): error MSB4019: The imported
project “C:\Microsoft.Cpp.Default.props” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
Done Building Project “C:\Users\Alexander\Projects\safe_browser\app\node_modules\ref\build\binding.vcxproj” (default targets) – FAILED.

Done Building Project “C:\Users\Alexander\Projects\safe_browser\app\node_modules\ref\build\binding.sln” (default target
s) – FAILED.

Build FAILED.

I’m using Win10, Command Prompt. Because you mentioned it, should I use PowerShell or is it equivalent?

1 Like

Use PowerShell, since there are some scripts in package.json that will have unrecognized commands if run in Command Prompt.

Try that while I look into the MSVC dependency. I’m interested to see if you run into a different set of errors when running with PowerShell.

I wish that I would have previously run into this problem on my system.

EDIT [additional comments]:

Can you confirm that you have Microsoft.Cpp at C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140?

I’m wondering if your environment variable is pointing to the correct location?
I’m looking at it on my end to figure out which key variable it is.

EDIT [try this]:

Open regedit

Look in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0 for VCTargetsPath to confirm that it and it’s value exist. If it does exist, what is the path?

Look here as well: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\14.0 for VCTargetsPath.

Did you recently install MSVC 2015? While doing so did you also uninstall a previous version, like 2012? I’m reading that the uninstaller fails to change it’s registry upon uninstall.

I’m now using PowerShell, but getting the same error.

Microsoft.Cpp ist not present. C:\Program Files (x86)\MSBuild contains only one folder “14.0”

In the registry I have the mentioned 14.0 entry in ToolsVersions containing several path keys but missing the VCTargetsPath. I have also searched the registry, this key doesn’t exist at all.

I just installed MSVC build tools 2015. No previous installation or other version. However I just intalled the build tools without installing Visual Studio. Could you state which version of MSVC you are using? Did you install the whole Studio?

I’m using Microsoft Visual Studio Community 2015, which comes with all the needed build tools.

Did you install just Visual C++ Build Tools?

Uninstall those build tools and then install the complete software.

Confirm that your registry has been updated after a clean install.

I now installed the build tools using the npm command: npm install --global --production windows-build-tools
This added the missing folders and resolved the MSVC errors above!

Now the comiler runs through (I guess) but doesn’t produce any exe files. I’m a little bit confused, because there aren’t any obvious error messages. The authenticator folder is empty. Should the built browser exe file be located directly in the safe_browser folder?

My npm install output looks like this:
https://pastebin.com/SMpKNsh2

The only strange lines I can spot are:

undefined postinstall C:\Users\Alexander\Projects\safe_browser
cd app && npm install && cd …/ && npm run build-safe-app

and

±- UNMET PEER DEPENDENCY react@^0.14.0 || ^15.0.0
±- UNMET PEER DEPENDENCY react-redux@^4.0.0 || ^5.0.0
±- UNMET PEER DEPENDENCY redux@^3.5.2

1 Like

Great! You’re almost there.

Now you need to run:
npm run pack-authenticator

and a few more commands after that: dev branch readme

1 Like

Nice! Ran into the same issue with libwinthread (which is hard to track because pack-authenticator didn’t produce any output) but now it works. Many thanks for your help. :slight_smile:

1 Like

Thank you for sharing your error logs. I gained more education by working through this one with you.
:seedling::herb::four_leaf_clover::evergreen_tree:

1 Like

One last question. :smiley: Do I have to configure the build process to use mock-routing manually?

Because, when I click on the rocket sign “Click to open authenticator” I only get this error:

request to http://localhost:8100/0.5/auth failed, reason: connect ECONNREFUSED 127.0.0.1:8100

Also navigating to safe-auth://home/#/login manually does not work.

Mock routing doesn’t need to be manually set. If you build everything from the dev branch the feature we’ll be automatically set when the Rust files compile.

When I read your log files, the scripts being run are from the package.json file in the dev branch, so I’m not sure what’s going on.

Do you have a repository with your build that I can look at?

Sorry, was busy the last days. As soon as I’ve time I’ll set up a repo. It’s just strange because it compiles without any errors…Maybe it’s an OS related / policy issue.

This topic was automatically closed after 60 days. New replies are no longer allowed.