I am not sure why but recently builds have started failing on Zeit now when using openzeppelin-network.js :
Cannot find module: '@openzeppelin/network/react'. Make sure this package is installed.
Running "npm run build"
09:55:50 PM > baseth@0.1.0 build /fargate/401a9336
09:55:50 PM > react-scripts build
09:55:52 PM Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.
09:55:52 PM Creating an optimized production build...
09:55:56 PM Failed to compile.
09:55:56 PM ./src/App.js
09:55:56 PM Cannot find module: '@openzeppelin/network/react'. Make sure this package is installed.
09:55:56 PM You can install this package by running: yarn add @openzeppelin/network/react.
09:55:56 PM npm
09:55:56 PM ERR! code ELIFECYCLE
09:55:56 PM npm
09:55:56 PM ERR! errno 1
09:55:56 PM npm
09:55:56 PM ERR! baseth@0.1.0 build: `react-scripts build`
09:55:56 PM npm ERR!
09:55:56 PM Exit status 1
09:55:56 PM npm ERR!
09:55:56 PM npm
09:55:56 PM ERR! Failed at the baseth@0.1.0 build script.
09:55:56 PM npm ERR!
09:55:56 PM This is probably not a problem with npm. There is likely additional logging output above.
09:55:56 PM npm ERR! A complete log of this run can be found in:
09:55:56 PM npm ERR! /fargate/.npm/_logs/2019-10-14T19_55_56_406Z-debug.log
09:55:56 PM Error: Exited with 1
09:55:56 PM at ChildProcess.child.on (/fargate/40f9385d99dd2d94/.build-utils/.builder/node_modules/@now/static-build/dist/index.js:23548:24)
09:55:56 PM at emitTwo (events.js:126:13)
09:55:56 PM at ChildProcess.emit (events.js:214:7)
09:55:56 PM at maybeClose (internal/child_process.js:925:16)
09:55:56 PM at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
09:55:56 PM worker exited with code 20 and signal null
09:55:58 PM done
I hadn’t used ZEIT Now previously (so apologies if my setup is different from yours).
I was able to deploy a very simple react application (using create-react-app) with openzeppelin-network.js and didn’t get any errors. (see code below).
I am also using "@openzeppelin/network": "^0.2.10"
Are you able to share your code or repository?
Have you tried using version 2.9?
Is the error on ZEIT Now always occurring or is it intermittent? Let me know if you find anything which could help track this down as would great to be able to reproduce and then resolve.
It is now occurring all the time on now. I once could solve it when I upgraded the lib to 0.2.10 but then it started again.
I will investigate it further & let you know but from my experience sometime things break in now for various reasons.
Hey @lil. Thank you for using OpenZeppelin network.js and I am sorry for issues you experience.
Network.js use preinstall npm hook to create symlink for react hooks. I think for some reason this symlink is not creatd on Zeit platform.
Can you try to import hooks directly from openzeppelin/network/lib/react and check if it makes any difference?
Example:
import { useWeb3Network, useEphemeralKey, useWeb3Injected } from '@openzeppelin/network/lib/react';
Hope it works for you and let me know how it goes!
Hello @ylv-io,
The workaround works great, many thanks
(what I did until now was to downgrade to oz network 0.2.5 as I couldn’t find a fix)
Thank you for your help & have a nice day !