Dev env setup notes
If it's useful, I was able to get this running on macOS Monterey (x86) but hit a few issues that made it made it a bit discouraging to get started:
- Install rust (maybe this was obvious but I'm new to rust)
- Surface this note about installing wasm-pack in the main README.md. Other notes about this:
- My machine isn't an M1, so this doesn't seem exclusive to M1s.
- I was alternatively able to use
npm install -g wasm-pack, and skip settingexport MACOSX_DEPLOYMENT_TARGET=10.7. I don't know which is better.
- I had some python issues with node-sass 7.0.1. I was able to resolve them by updating node-sass to 8.0.0 in packages/react/package.json, and
export PYTHON=/usr/bin/python3. Not sure what the right solution here is. - For c2pa-wc
rushx storybook, I needed to firstexport NODE_OPTIONS=--openssl-legacy-provider.
Some error snippets for searchability by anyone else running into these issues.
Error from rush build when wasm-pack missing.
Error: spawn wasm-pack ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
...9 lines omitted...
'--quiet',
'--out-name',
'toolkit',
'--release',
'--target',
'web'
]
}
Error from rush install when node-sass has issues with python.
.../node_modules/node-sass postinstall$ node scripts/build.js
│ Building: /usr/local/bin/node /Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-gyp/bin/node-gyp.js rebuild --v
│ gyp info it worked if it ends with ok
│ gyp verb cli [
│ gyp verb cli '/usr/local/bin/node',
│ gyp verb cli '/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-gyp/bin/node-gyp.js',
│ gyp verb cli 'rebuild',
│ gyp verb cli '--verbose',
│ gyp verb cli '--libsass_ext=',
│ gyp verb cli '--libsass_cflags=',
│ gyp verb cli '--libsass_ldflags=',
│ gyp verb cli '--libsass_library='
│ gyp verb cli ]
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp verb command rebuild []
│ gyp verb command clean []
│ gyp verb clean removing "build" directory
│ gyp verb command configure []
│ gyp verb find Python Python is not set from command line or npm configuration
│ gyp verb find Python Python is not set from environment variable PYTHON
│ gyp verb find Python checking if "python3" can be used
│ gyp verb find Python - executing "python3" to get executable path
│ gyp verb find Python - "python3" is not in PATH or produced an error
│ gyp verb find Python checking if "python" can be used
│ gyp verb find Python - executing "python" to get executable path
│ gyp verb find Python - "python" is not in PATH or produced an error
│ gyp ERR! find Python
│ gyp ERR! find Python Python is not set from command line or npm configuration
│ gyp ERR! find Python Python is not set from environment variable PYTHON
│ gyp ERR! find Python checking if "python3" can be used
│ gyp ERR! find Python - "python3" is not in PATH or produced an error
│ gyp ERR! find Python checking if "python" can be used
│ gyp ERR! find Python - "python" is not in PATH or produced an error
│ gyp ERR! find Python
│ gyp ERR! find Python **********************************************************
│ gyp ERR! find Python You need to install the latest version of Python.
│ gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
│ gyp ERR! find Python you can try one of the following options:
│ gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
│ gyp ERR! find Python (accepted by both node-gyp and npm)
│ gyp ERR! find Python - Set the environment variable PYTHON
│ gyp ERR! find Python - Set the npm configuration variable python:
│ gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
│ gyp ERR! find Python For more information consult the documentation at:
│ gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
│ gyp ERR! find Python **********************************************************
│ gyp ERR! find Python
│ gyp ERR! configure error
│ gyp ERR! stack Error: Could not find any Python installation to use
│ gyp ERR! stack at PythonFinder.fail (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-gyp/lib/find-python.
│ gyp ERR! stack at PythonFinder.runChecks (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-gyp/lib/find-py
│ gyp ERR! stack at PythonFinder.<anonymous> (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-gyp/lib/find-
│ gyp ERR! stack at PythonFinder.execFileCallback (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-gyp/lib/
│ gyp ERR! stack at exithandler (node:child_process:420:5)
│ gyp ERR! stack at ChildProcess.errorhandler (node:child_process:432:5)
│ gyp ERR! stack at ChildProcess.emit (node:events:513:28)
│ gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:289:12)
│ gyp ERR! stack at onErrorNT (node:internal/child_process:476:16)
│ gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
│ gyp ERR! System Darwin 21.6.0
│ gyp ERR! command "/usr/local/bin/node" "/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-gyp/bin/node-gyp.js"
│ gyp ERR! cwd /Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-sass
│ gyp ERR! node -v v18.12.1
│ gyp ERR! node-gyp -v v8.4.1
│ gyp ERR! not ok
│ Build failed with error code: 1
└─ Failed in 507ms at /Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-sass
ELIFECYCLE Command failed with exit code 1.
The command failed:
/Users/ryan/src/c2pa-js/common/temp/pnpm-local/node_modules/.bin/pnpm install --store /Users/ryan/src/c2pa-js/common/temp/pnpm-store --config.cacheDir=/Users/ryan/src/c2pa-js/common/temp/pnpm-store --config.stateDir=/Users/ryan/src/c2pa-js/common/temp/pnpm-store --no-prefer-frozen-lockfile --strict-peer-dependencies --config.ignoreCompatibilityDb --recursive --link-workspace-packages false
ERROR: Error: The command failed with exit code 1
Giving up after 1 attempts
ERROR: The command failed with exit code 1
Crypto error running rushx storybook
info => Ignoring cached manager due to change in manager config
ℹ 「wdm」: wait until bundle finished:
node:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/Users/ryan/src/c2pa-js/common/temp/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:205:4) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Thanks @ryprice - we will look into updating the documentation. Also we can see about eliminating node-sass from the dependency tree in React, optimally we don't want something that needs to bring in node-gyp due to complexities such as these.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/CAI-5243 is successfully created for this GitHub issue.