vue-formbuilder icon indicating copy to clipboard operation
vue-formbuilder copied to clipboard

Errors during npm install

Open miro-ux opened this issue 2 years ago • 0 comments

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:

  1. Run npm i -g npm
  2. delete package-lock.json file
  3. delete node_modules folder
  4. Run npm cache clean --force
  5. Run npm cache verify
  6. 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!

miro-ux avatar Feb 24 '23 05:02 miro-ux