mammoth.js icon indicating copy to clipboard operation
mammoth.js copied to clipboard

Can't build browser version from source on Windows

Open mdarens opened this issue 6 years ago • 4 comments

In the following environment:

> winver
Windows 10 Pro Version 1709 (Build 16299.611)

> node --version
v8.11.1

> npm --version
5.6.0

> npm view make version
0.8.1
$ make setup
make i info Invoking setup target
make i info Invoking npm-install target
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> [email protected] prepublish C:\dev\mammoth.js
> make mammoth.browser.min.js

make i info Invoking mammoth.browser.min.js target
make i info Invoking mammoth.browser.js target
'node_modules' is not recognized as an internal or external command,
operable program or batch file.
make × ERR  node_modules/.bin/browserify lib/index.js --standalone mammoth -p browserify-prepend-licenses > $@
make × ERR  Recipe exited with code %d
(node:30984) UnhandledPromiseRejectionWarning: Error: Recipe exited with code %d    at ChildProcess.<anonymous> (C:\Users\Mark.DArensbourg\AppData\Roaming\npm\node_modules\make\src\cli.js:143:28)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:30984) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)(node:30984) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
up to date in 1.378smake i info Invoking mammoth.browser.min.js targetmake i info Invoking mammoth.browser.js target
'node_modules' is not recognized as an internal or external command,
operable program or batch file.
make × ERR  node_modules/.bin/browserify lib/index.js --standalone mammoth -p browserify-prepend-licenses > $@
make × ERR  Recipe exited with code %d
(node:10792) UnhandledPromiseRejectionWarning: Error: Recipe exited with code %d    at ChildProcess.<anonymous> (C:\Users\Mark.DArensbourg\AppData\Roaming\npm\node_modules\make\src\cli.js:143:28)
    at emitTwo (events.js:126:13)    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)(node:10792) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)(node:10792) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

mdarens avatar Sep 04 '18 19:09 mdarens

I don't have a Windows installation handy at the moment, so I can't try things out. Having said that, the right solution is probably to call browserify from an npm script, which I think should also fix things on Windows.

mwilliamson avatar Sep 04 '18 19:09 mwilliamson

when i try to update apidoc protobuf,i met the same question.And i resolved this by the following commands: $ rm -rf /usr/local/lib/node_modules $ brew uninstall node $ brew install node --without-npm $ echo prefix=~/.npm-packages >> ~/.npmrc $ curl -L https://www.npmjs.com/install.sh | sh You can try this. Best wishes!

JoelynZhou avatar Oct 10 '19 06:10 JoelynZhou

try : update makefile file

  1. node_modules.bin\browserify .\lib\index.js --standalone mammoth -p browserify-prepend-licenses > mammoth.browser.js

  2. node_modules.bin\uglifyjs mammoth.browser.js -c > mammoth.browser.min.js

  3. npm install

  4. open browser-demo/index.html

fadeli1 avatar Jan 21 '20 07:01 fadeli1

try : update makefile file

  1. node_modules.bin\browserify .\lib\index.js --standalone mammoth -p browserify-prepend-licenses > mammoth.browser.js
  2. node_modules.bin\uglifyjs mammoth.browser.js -c > mammoth.browser.min.js
  3. npm install
  4. open browser-demo/index.html

I found the problem, the separator in windows is '' and this file just use '/'.

image

XXPro avatar May 31 '21 11:05 XXPro