Just wanted to share some issues that I encountered and how to fix them:
Out of the box, running npm install
resulted in same error as in this issue
What @abhimanusharma recommended worked:
- Run npm i -g npm
- delete package-lock.json file
- delete node_modules folder
- Run npm cache clean --force
- Run npm cache verify
- Run npm install
Despite installing, it was still throwing an error:
npm ERR! code 1
npm ERR! path ...\vue-formbuilder\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
Tried to run npm run serve
anyway but got:
ERROR Failed to compile with 1 error
error in ./src/assets/scss/main.scss
Syntax Error: Error: Node Sass version 8.0.0 is incompatible with ^4.0.0.
Removing the deprecated node-sass
and replacing it with sass
did the trick:
npm uninstall node-sass
npm install sass
Finally on NodeJS 16+ it will throw yet another error (about SSL, unrelated to this package):
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
Was able to resolve by modifying the script commands in package.json
:
"scripts": {
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"lint": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint"
},
(Use EXPORT
instead of SET
on Linux)
Runs great now!
Hope this helps someone.
Thanks!