googlearchive / vrview

Library for embedding immersive media into traditional websites.
http://developers.google.com/cardboard/vrview
Apache License 2.0
1.71k stars 1.09k forks source link

Unable to build on Win10 #232

Open Petr7 opened 7 years ago

Petr7 commented 7 years ago

Hi,

I am new to npm and trying to solve build the vrview on win10, but I tried everything and google can not help anymore :(

Can anybody help me where is problem? Here is the log from npm-debug.

in cmd I type npm run build and get this

0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'build' ] 2 info using npm@3.10.10 3 info using node@v6.11.1 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ] 5 info lifecycle vrview@2.0.1~prebuild: vrview@2.0.1 6 silly lifecycle vrview@2.0.1~prebuild: no script for prebuild, continuing 7 info lifecycle vrview@2.0.1~build: vrview@2.0.1 8 verbose lifecycle vrview@2.0.1~build: unsafe-perm in lifecycle true 9 verbose lifecycle vrview@2.0.1~build: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\dev\localhost\vr2\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs\;C:\Users\carad\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Java\jre7\bin;C:\Users\carad\AppData\Roaming\npm 10 verbose lifecycle vrview@2.0.1~build: CWD: C:\dev\localhost\vr2 11 silly lifecycle vrview@2.0.1~build: Args: [ '/d /s /c', 11 silly lifecycle 'npm run build-min; npm run build-dev; npm run build-api' ] 12 silly lifecycle vrview@2.0.1~build: Returned: code: 1 signal: null 13 info lifecycle vrview@2.0.1~build: Failed to exec build script 14 verbose stack Error: vrview@2.0.1 build: npm run build-min; npm run build-dev; npm run build-api 14 verbose stack Exit status 1 14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at EventEmitter.emit (events.js:191:7) 14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at ChildProcess.emit (events.js:191:7) 14 verbose stack at maybeClose (internal/child_process.js:891:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 15 verbose pkgid vrview@2.0.1 16 verbose cwd C:\dev\localhost\vr2 17 error Windows_NT 10.0.14393 18 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build" 19 error node v6.11.1 20 error npm v3.10.10 21 error code ELIFECYCLE 22 error vrview@2.0.1 build: npm run build-min; npm run build-dev; npm run build-api 22 error Exit status 1 23 error Failed at the vrview@2.0.1 build script 'npm run build-min; npm run build-dev; npm run build-api'. 23 error Make sure you have the latest version of node.js and npm installed. 23 error If you do, this is most likely a problem with the vrview package, 23 error not with npm itself. 23 error Tell the author that this fails on your system: 23 error npm run build-min; npm run build-dev; npm run build-api 23 error You can get information on how to open an issue for this project with: 23 error npm bugs vrview 23 error Or if that isn't available, you can get their info via: 23 error npm owner ls vrview 23 error There is likely additional logging output above. 24 verbose exit [ 1, true ]

XBOOS commented 7 years ago

I got the same problem. Wonder how to solve it.

BrendanCarlin commented 7 years ago

I had a similar issue on Windows. Here's what I did to resolve:

First make sure you're using the most up-to-date versions of node and npm. Then, make sure you're running npm install before running npm run build.

The use of semi-colons to support multiple scripts on a single line does not play nicely with Windows command line. So anywhere you see a script like npm run build-min; npm run build-dev; npm run build-api, try replacing those semi-colons with &&.

Based on my experience, you may also run into an issue with _mkdir being called in each script. NPM throws an error for me whenever it sees an existing build or -p directory. So I updated the scripts object in package.json to only execute _mkdir once. After the first call to _mkdir, I removed any other instance of npm run __mkdir && in the subsequent scripts that were invoked by npm run build.

bftaylor commented 7 years ago

I had the same problem, following Brendan's comment and changing mkdir to "_mkdir": "if not exist build mkdir build", fixed it for me

BrendanCarlin commented 7 years ago

@bftaylor Happy to hear my post helped you. Good call on the if statement for mkdir. The crux of the original error posted was from the script line performing multiple npm actions with a semicolon to separate the indiviidual scripts. It simply doesnt work on Windows. If he/she updates each semicolon to &&, that specific error will stop occurring. All the orher commentary in my original post will most likely be relevant based on orher hurdles I encounteted, but the semicolons in those scripts are the reason he/she was receiving that specific error on windows. Would love to hear from the original poster if that helped.

jongc commented 6 years ago

I have the same problem. The fixes mentioned by @BrendanCarlin and @bftaylor do not fix the error for all of the commands for me. The commands that still throw errors are...


$ npm run build # builds the iframe embed and JS API (full and minified versions).
$ npm run build-min # builds the minified iframe embed.
$ npm run build-dev # builds the full iframe embed.```
BrendanCarlin commented 6 years ago

@jongc what's the error?

jongc commented 6 years ago

It looks like all three commands that are failing are throwing the same error that says...

'java' is not recognized as an internal or external command, operable program or batch file.

I went and downloaded JDK9 and set my machine's environment variables to point to the bin folders. My problems are all clear now. I didn't know that I needed JDK for this project.

AlfkaGit commented 6 years ago

Thank you all. I have reduced a lot of the errors that occur in Windows for the npm run build command, However, as a newbie I still get some errors and no items are created in the build folder.

Here are the errors. Thank you for your help.

U:\vrview-master>npm run build

vrview@2.0.1 build U:\vrview-master npm run build-min && npm run build-dev && npm run build-api

npm WARN invalid config loglevel="notice"

vrview@2.0.1 build-min U:\vrview-master npm run _mkdir && browserify src/embed/main.js | derequire | uglifyjs -c > build/embed.min.js && npm run build-three-closure

npm WARN invalid config loglevel="notice"

vrview@2.0.1 _mkdir U:\vrview-master if not exist build mkdir build

'derequire' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 255 npm ERR! vrview@2.0.1 build-min: npm run _mkdir && browserify src/embed/main.js | derequire | uglifyjs -c > build/embed.min.js && npm run build-three-closure npm ERR! Exit status 255 npm ERR! npm ERR! Failed at the vrview@2.0.1 build-min script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\acely\AppData\Roaming\npm-cache_logs\2017-10-09T19_55_54_915Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 255 npm ERR! vrview@2.0.1 build: npm run build-min && npm run build-dev && npm run build-api npm ERR! Exit status 255 npm ERR! npm ERR! Failed at the vrview@2.0.1 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\acely\AppData\Roaming\npm-cache_logs\2017-10-09T19_55_55_030Z-debug.log