Can install sass-loader in Vue 3 project - node.js

I am trying to add sass/scss loader AFTER creating a project with vue CLI.
I ran this script:
$ npm install -D sass-loader#^10 sass
and I am receiving following error:
npm ERR! notsup Unsupported platform for fsevents#2.3.1: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
It worked for me in empty project that i created to test this. But in my project does not work.
I am using Ubuntu 20.04
this is my package.json file:
{
"name": "hikegear",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.34",
"#fortawesome/free-solid-svg-icons": "^5.15.2",
"#fortawesome/vue-fontawesome": "^3.0.0-3",
"chart.js": "^2.9.4",
"core-js": "^3.6.5",
"sortablejs": "^1.13.0",
"vue": "^3.0.5",
"vue-router": "^4.0.3",
"vuedraggable": "^4.0.1",
"vuex": "^4.0.0-rc.2",
"vuex-persistedstate": "^4.0.0-beta.3"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0-0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

try deleting your package-lock.json file and node_modules folder and then installing your dependencies again
rm -r node_modules package.json
npm i

Yes you can. add following dependecis in your package.json and run npm i.
"devDependencies": {
"sass-loader": "^7.2.0",
"sass": "^1.22.10",
}
for add global variables you need to make vue.config.js in root directory if not exist. then add your scss varibale file.
module.exports = {
css: {
loaderOptions: {
sass: {
additionalData: '#import "#/assets/styles/file.scss";',
implementation: require('node-sass')
},
},
},
};

Related

Laravel/NodeJS - npm ERR! Missing script: "watch"

I've upgraded to Laravel 9 recently.
Here is my package.json:
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"#vitejs/plugin-vue": "^3.0.3",
"autoprefixer": "^10.4.8",
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"laravel-vite-plugin": "^0.6.0",
"lodash": "^4.17.19",
"postcss": "^8.4.16",
"tailwindcss": "^3.1.8",
"vite": "^3.0.9"
},
"dependencies": {
"alpinejs": "^3.8.1",
"laravel-echo": "^1.11.3",
"pusher-js": "^7.0.3"
},
"name": "beastburst-website",
"description": "<p align=\"center\"><img src=\"https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg\" width=\"400\"></p>",
"version": "1.0.0",
"main": "tailwind.config.js",
"directories": {
"test": "tests"
},
"repository": {
"type": "git",
"url": "https://code.scarsgaming.net/BeastBurst/BeastBurst-Website.git"
},
"keywords": [],
"author": "",
"license": "ISC"
}
When I run npm run watch I get the following error:
npm ERR! Missing script: "watch"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/venelin/.npm/_logs/2022-08-31T11_40_11_910Z-debug-0.log
Any idea why and how can I fix that?
The default bundler for Laravel now is Vite as you can clearly see from your package.json
If you do not want to use Vite, use this guide to switch to mix
I should also mention that Vite is much faster that mix.
try npm run dev it will work like npm run watch that is because Laravel 9 now uses Vite.

npm error during publish - incorrect version of babel-eslint

I have a .net core 3.1 with react application and i'm trying to publish it with Visual Studio 2019.
I am receiving the following error:
The react-scripts package provided by Create React App requires a
dependency: "babel-eslint": "10.1.0"
Don't try to install it manually: your package manager does it automatically. However, a different version of babel-eslint was
detected higher up in the tree:
C:\projects\node_modules\babel-eslint (version: 10.0.1)
I have no idea how babel-eslint version 10.0.1 is getting installed.
Running npm ls does not show any packages with a dependency of babel-eslint 10.0.1.
Here is the package.json file:
{
"private": true,
"dependencies": {
"axios": "^0.19.2",
"font-awesome": "^4.7.0",
"jquery": "^3.5.1",
"merge": "^1.2.1",
"oidc-client": "^1.9.0",
"react": "^16.0.0",
"react-bootstrap": "^1.3.0",
"react-bootstrap-table-next": "^4.0.3",
"react-bootstrap-table2-paginator": "^2.1.2",
"react-bootstrap-table2-toolkit": "^2.1.3",
"react-dom": "^16.0.0",
"react-router-bootstrap": "^0.25.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"reactstrap": "^6.3.0",
"rimraf": "^2.6.2"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^10.1.0",
"eslint": "^7.10.0",
"cross-env": "^5.2.0",
"typescript": "^3.5.2"
},
"eslintConfig": {
"extends": "react-app"
},
"scripts": {
"start": "rimraf ./build && react-scripts start",
"build": "react-scripts build",
"test": "cross-env CI=true react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "eslint ./src/"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
I do not see babel-eslint v10.0.1 in the package-lock.json file either.
Here are all of the references to babel-eslint in the package-lock.json file:
"babel-eslint": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz",
"requires": {
"#babel/code-frame": "^7.0.0",
"#babel/parser": "^7.7.0",
"#babel/traverse": "^7.7.0",
"#babel/types": "^7.7.0",
"eslint-visitor-keys": "^1.0.0",
"resolve": "^1.12.0"
}
},
"react-scripts": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-3.4.3.tgz",
"requires": {
"#babel/core": "7.9.0",
"#svgr/webpack": "4.3.3",
"#typescript-eslint/eslint-plugin": "^2.10.0",
"#typescript-eslint/parser": "^2.10.0",
"babel-eslint": "10.1.0",
"babel-jest": "^24.9.0",
"babel-loader": "8.1.0",
"babel-plugin-named-asset-import": "^0.3.6",
"babel-preset-react-app": "^9.1.2",
}
I have tried uninstalling all version of babel-eslint (npm uninstall babel-eslint) but somehow the older version keeps getting installed every time i do an npm install
How can i stop the older version of babel-eslint from being installed?
After reviewing the packages being installed i was able to update the package.json file with compatible packages. Deleted package-lock.json and the node_modules directory then did npm install and it worked successfully

Encounter " 'vue-cli-service' is not recognized as an internal or external command" after using npm install --production

Our production environment have to using "npm install --production" to install the project, but when trigger "npm run serve" that encounter Below error:
'vue-cli-service' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
Here is the command sequence :
npm install --production
npm run serve
Below is the package.json
{
"name": "xxxxxx",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.19.0",
"bootstrap": "^4.4.1",
"bootstrap-vue": "^2.7.0",
"core-js": "^3.4.3",
"vue": "^2.6.11",
"vue-router": "^3.1.3"
},
"devDependencies": {
"#vue/cli-plugin-babel": "^4.1.0",
"#vue/cli-plugin-eslint": "^4.1.0",
"#vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {
"no-console": "off"
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"browserslist": [
"> 1%",`enter code here`
"last 2 versions"
]
}
Could anyone help on this case ? Many thanks...
Does the serve script require your devDependencies? If you run npm install then npm run serve does it work?
Can you run vue --version from your prod environment? That error makes me think the whole #vue/cli global install is missing.
Post may be a dupe: How to solve 'vue-cli-service' is not recognized as an internal or external command?
Just in case, you may want to rm -rf node_modules then install, then serve.

Cannot find module 'prettier'

I updated all packages but still getting this error after running npm run serve:
Module build failed (from ./node_modules/eslint-loader/index.js):
Error: Cannot find module 'prettier' Occurred while linting /home
My package.json
{
"name": "app",
"version": "0.1.0",
"private": false,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.2.1",
"firebase": "^7.0.0",
"material-icons": "^0.3.1",
"register-service-worker": "^1.6.2",
"vue": "^2.6.10",
"vue-flickity": "^1.2.1",
"vue-router": "^3.1.3",
"vuetify": "^2.0.19",
"vuex": "^3.1.1"
},
"devDependencies": {
"#mdi/font": "^4.4.95",
"#vue/cli-plugin-babel": "^3.11.0",
"#vue/cli-plugin-eslint": "^3.11.0",
"#vue/cli-plugin-pwa": "^3.11.0",
"#vue/cli-service": "^3.11.0",
"#vue/eslint-config-prettier": "^5.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^6.4.0",
"eslint-plugin-vue": "^5.2.3",
"material-design-icons-iconfont": "^5.0.1",
"stylus": "^0.54.7",
"stylus-loader": "^3.0.2",
"uglifyjs-webpack-plugin": "^2.2.0",
"vue-cli-plugin-vuetify": "^0.6.3",
"vue-template-compiler": "^2.6.10",
"vuetify-loader": "^1.3.0",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"#vue/prettier"
],
"rules": {
"no-console": "off"
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
**"#vue/eslint-config-prettier": "^5.0.0",** is listed in the dependencies. How to fix this issue? (I'm using VSCODE on Ubuntu)
I tried multiple times deleting package-lock.json and node_modules and running npm install afterwards. Nothing fixes it - even updating all packages globally.
Prettier is a peer dependency of
#vue/eslint-config-prettier so you need to add it to your own dependencies:
npm install --save-dev prettier
With NPM
npm install --save-dev prettier
With Yarn
yarn add --dev prettier
if you're using yarn 3, and yarn add --dev prettier doesn't solve your problem, try this:
cmd + shift + p
in the dropdown, search for preferences: open user settings (json)
add "prettier.prettierPath": ".yarn/sdks/prettier/index.js" to your json file.
This tells your editor to find the module in the path you added.

npm install <package> working and npm install not working

If I download the source code and run:
npm install
It crashes during installation ( I think it runs out of memory), however if I directly:
npm install bigchaindb-driver
(version 0.3.0)
Then is fine...
Log error:
npm http request GET https://registry.npmjs.org/is-fullwidth-code-point
npm http 304 https://registry.npmjs.org/is-fullwidth-code-point
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/lcid
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/mem
npm http 304 https://registry.npmjs.org/lcid
npm http 304 https://registry.npmjs.org/mem
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/invert-kv
npm http 304 https://registry.npmjs.org/invert-kv
npm info lifecycle bigchaindb-driver#0.3.0~preinstall: bigchaindb-driver#0.3.0
Killed ....] - extract:moo-server: sill gunzTarPerm extractEntry lolex.js
Btw if I install them one by one, it does not run out of memory but it is not able to install the following dependencies:
bigchaindb-driver#0.3.0 /
+-- UNMET PEER DEPENDENCY babel-eslint#8.0.0
+-- UNMET PEER DEPENDENCY eslint#4.1.1
`-- UNMET PEER DEPENDENCY webpack#3.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN babel-loader#7.0.0 requires a peer of webpack#2 but none was installed.
npm WARN eslint-config-airbnb-base#11.3.2 requires a peer of eslint#^3.19.0 || ^4.5.0 but none was installed.
npm WARN eslint-config-airbnb-base#11.3.2 requires a peer of eslint-plugin-import#^2.7.0 but none was installed.
npm WARN eslint-config-ascribe#3.0.4 requires a peer of babel-eslint#^7.1.1 but none was installed.
npm WARN eslint-plugin-import#2.2.0 requires a peer of eslint#2.x - 3.x but none was installed.
Why with one method is working and with the other no? what is the difference between the commands and how could I fix it?
Edit:
Ubuntu 16.04 64bit
npm 3.10.10
nodejs 6.11.4
bigchaindb-driver 0.3.0
Package.json:
{
"_args": [
[
{
"raw": "bigchaindb-driver",
"scope": null,
"escapedName": "bigchaindb-driver",
"name": "bigchaindb-driver",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"/test_bcdb"
]
],
"_from": "bigchaindb-driver#latest",
"_id": "bigchaindb-driver#0.3.0",
"_inCache": true,
"_location": "/bigchaindb-driver",
"_nodeVersion": "7.8.0",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/bigchaindb-driver-0.3.0.tgz_1499272002696_0.40300624282099307"
},
"_npmUser": {
"name": "vrde",
"email": "agranzot#gmail.com"
},
"_npmVersion": "5.0.4",
"_phantomChildren": {},
"_requested": {
"raw": "bigchaindb-driver",
"scope": null,
"escapedName": "bigchaindb-driver",
"name": "bigchaindb-driver",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/bigchaindb-driver/-/bigchaindb-driver-0.3.0.tgz",
"_shasum": "2c71ab0e49dd7cbd6f760639767d4148e911e92b",
"_shrinkwrap": null,
"_spec": "bigchaindb-driver",
"_where": "/test_bcdb",
"author": {
"name": "BigchainDB"
},
"ava": {
"files": [
"test/*.js"
],
"source": [
"**/*.{js,jsx}",
"!node_modules/**/*",
"!dist/**/*"
],
"failFast": true,
"failWithoutAssertions": false,
"tap": true,
"powerAssert": false,
"require": [
"babel-register"
],
"babel": "inherit"
},
"browser": "./dist/browser/bigchaindb-driver.cjs2.min.js",
"bugs": {
"url": "https://github.com/bigchaindb/js-bigchaindb-driver/issues"
},
"dependencies": {
"browser-resolve": "^1.11.2",
"bs58": "^4.0.0",
"buffer": "^5.0.2",
"clone": "^2.1.0",
"core-js": "^2.4.1",
"decamelize": "^1.2.0",
"es6-promise": "^4.0.5",
"fetch-ponyfill": "^4.0.0",
"five-bells-condition": "^5.0.1",
"isomorphic-fetch": "^2.2.1",
"js-sha3": "^0.6.1",
"js-utility-belt": "^1.5.0",
"json-stable-stringify": "^1.0.1",
"query-string": "^4.3.4",
"sprintf-js": "^1.0.3",
"tweetnacl": "^1.0.0",
"yarn": "^0.27.5"
},
"description": "Node.js driver for BigchainDB",
"devDependencies": {
"ava": "^0.20.0",
"babel-cli": "^6.22.2",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015-no-commonjs": "0.0.2",
"babel-preset-latest": "^6.22.0",
"babel-runtime": "^6.22.0",
"cross-env": "^5.0.1",
"eslint": "^4.1.1",
"eslint-config-ascribe": "^3.0.4",
"eslint-plugin-import": "^2.2.0",
"husky": "^0.14.0",
"lint-staged": "^4.0.0",
"nyc": "^11.0.2",
"release-it": "^2.7.3",
"rimraf": "^2.5.4",
"sinon": "^2.3.4",
"webpack": "^3.0.0"
},
"directories": {},
"dist": {
"integrity": "sha512-zpy0xZ73PXfH2k5sNTukgd7drPvGrHcPdA520glBGRiv3pfENo3TBFtNfGBymGRVRfQ519GFR+vzCbmftCs24w==",
"shasum": "2c71ab0e49dd7cbd6f760639767d4148e911e92b",
"tarball": "https://registry.npmjs.org/bigchaindb-driver/-/bigchaindb-driver-0.3.0.tgz"
},
"gitHead": "a9fb0730727a7aca3d0f61662ad043dfca3b284f",
"homepage": "https://www.bigchaindb.com/",
"keywords": [
"bigchaindb",
"driver",
"blockchain",
"decentralized",
"dapp"
],
"license": "Apache-2.0",
"lint-staged": {
"*.js": [
"eslint"
]
},
"main": "./dist/node/index.js",
"maintainers": [
{
"name": "vrde",
"email": "agranzot#gmail.com"
}
],
"name": "bigchaindb-driver",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/bigchaindb/js-bigchaindb-driver.git"
},
"scripts": {
"build": "npm run clean && npm run build:cjs && npm run build:dist",
"build:bundle": "webpack",
"build:cjs": "cross-env BABEL_ENV=cjs babel ./src -d dist/node",
"build:dist": "cross-env NODE_ENV=production webpack -p",
"clean": "rimraf dist/bundle dist/node",
"lint": "eslint ./",
"precommit": "lint-staged",
"prepublishOnly": "npm update && npm run build",
"release": "./node_modules/release-it/bin/release.js --src.tagName='v%s' --github.release --npm.publish --non-interactive",
"release-major": "./node_modules/release-it/bin/release.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive",
"release-minor": "./node_modules/release-it/bin/release.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive",
"report-coverage": "nyc report --reporter=lcov > coverage.lcov && codecov",
"test": "npm run lint && nyc ava test/ && npm run thanks && npm run report-coverage",
"thanks": "cowsay Hi, thanks for your interest in BigchainDB. We appreciate your contribution!"
},
"version": "0.3.0"
}
The package.json is the original from js-bigchaindb-driver
Finally, I found the source of the error:
npm install
Installs the package with the development dependencies and it is needed to add the flag --production not to get them.
So the equivalent will be:
npm install <package>
and
npm install --production
(assuming there is a package.json in the directory)

Resources