I'm facing a problem with npm run serve ( vue js project ) - javascript

I am getting an error when trying to run npm run serve.
At fist I tried to work with vue in laravel project and run the "npm run serve command".
After that I uninstalled vue as well as vue/cli and reinstall them again. Then i created new vue project in independent folder. But when I am trying to run server as -> npm run serve at I'm getting the same error as when i tried it in the laravel project.
I used below codes for installation:
npm run serve => the vue and laravel project
npm run dev => the laravel project
This is the error :
$ npm run serve
vue-1#0.1.0 serve P:\codes & projects\vue\Tutorials\vue-1
vue-cli-service serve
'projects\vue\Tutorials\vue-1\node_modules\.bin\' is not recognized as an intern
al or external command,
operable program or batch file.
internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module 'P:\#vue\cli-service\bin\vue-cli-service.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js
:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-1#0.1.0 serve: vue-cli-service serve**
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-1#0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ahmad\AppData\Roaming\npm-cache\_logs\2020-09-13T16_12_03_
919Z-debug.log
And This is an image for the error in the bash terminal :
enter image description here

Related

When i run the npm run build for react project i am getting the error, please check below code

'REACT_APP_BUILD_ENV' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! argon-dashboard-pro-react#1.2.0 build: `react-csp dev && REACT_APP_BUILD_ENV='test' react-scripts build && gulp licenses`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the argon-dashboard-pro-react#1.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Shubham Jayswal\AppData\Roaming\npm-cache\_logs\2022-03-22T13_44_53_411Z-debug.log
I am trying to build my code but when I run npm run build with react project getting every time error, stuck there don't have an idea how to resolve that error, could please give me solution how to fix that error.
I am using Windows.
if on windows
change build in package.json to
react-csp dev && set REACT_APP_BUILD_ENV='test' react-scripts build && gulp licenses

Error when typing "npm start" in visual studio using react.js

PS C:\Users\PC1\Downloads\portfolio_website-STARTER> npm start
> portfolio_website-starter#1.0.0 start C:\Users\PC1\Downloads\portfolio_website-STARTER
> node index.js
internal/modules/cjs/loader.js:892
throw err;
^
Error: Cannot find module 'C:\Users\PC1\Downloads\portfolio_website-STARTER\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio_website-starter#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio_website-starter#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PC1\AppData\Roaming\npm-cache\_logs\2021-09-05T22_40_19_833Z-debug.log
PS C:\Users\PC1\Downloads\portfolio_website-STARTER>
The error shown above happens when I try to run npm start to start the virtual host.
I have tried the following:
Updated node.js to the latest version.
Went to package.json under scripts and added "start": "node index.js".
first, do you install the dependencies? (npm i)
Then, exists index.js file in the portfolio_website-STARTER folder?
First make sure your startup file is index.js in your package.json file and make sure you have index.js in your project.

issue when running npm run serve in vue project

I've got an issue when try running server for vue project
this is the issue
ERROR Error: No valid exports main found for
' PROJECT PATH\node_modules\colorette'
Error: No valid exports main found for
'PROJECT PATH\node_modules\colorette'
at resolveExportsTarget (internal/modules/cjs/loader.js:622:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:654:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\AlaaMohammed\PhpstormProjects\vue-2\node_modules\autoprefixer\lib\autoprefixer.js:5:17)
at Module._compile (internal/modules/cjs/loader.js:1139:30) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! vue-2#0.1.0 serve:
vue-cli-service serve npm ERR! Exit status 1 npm ERR! npm ERR!
Failed at the vue-2#0.1.0 serve script. npm ERR! This is probably not
a problem with npm. There is likely additional logging output above.
I want some to response to my problem
try to reinstall the colerette plugin version 1.2.0 manually
npm i colorette#1.2.0
Upgrade node to version 14.5 will resolve this issue.
I did the following and it worked:
1)_ First i checked the versions
npm outdated
npm update
npm install
npx npm-check-updates - u
2)_ Once i was 100% sure the problems didn't come from that source, i typed the following:
npm install autoprefixer#9.8.0
and it solved the problem.
Note: try to "npm start" before you connect the scss to the App, just to see if you can visualize something (like: hello world) in the browser, if everything is fine, create the folder scss with the main.scss inside of it, import it and then try the steps.
My node -v: v16.1.0
What worked for me npm ci
Updating the node version can solve your problem.

Unable to call npm run build using vue-cli in production

Expected Behavior
npm run build should create the production dist bundle that I can serve on a given machine
Current Behavior
Despite being able to build locally, whenever I try to run npm run build on an external resource (such as a Digital Ocean VM or Heroku machine), I receive the below error.
Failure Logs
root#nodejs-lazyq-dev:/var/www/html/Vue# npm run build
> vue-material-dashboard-pro#1.0.0 build /var/www/html/Vue
> vue-cli-service build
⠴ Building for production...
ERROR Failed to compile with 1 errors 09:29:00
error in ./src/assets/scss/_material-dashboard.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):
#import "md/plugins/fullCalendar";
^
File to import not found or unreadable: md/plugins/fullCalendar.
in /var/www/html/Vue/src/assets/scss/_material-dashboard.scss (line 59, column 1)
at runLoaders (/var/www/html/Vue/node_modules/webpack/lib/NormalModule.js:286:20)
at /var/www/html/Vue/node_modules/loader-runner/lib/LoaderRunner.js:364:11
at /var/www/html/Vue/node_modules/loader-runner/lib/LoaderRunner.js:230:18
at context.callback (/var/www/html/Vue/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.asyncSassJobQueue.push [as callback] (/var/www/html/Vue/node_modules/sass-loader/lib/loader.js:55:13)
at Object.done [as callback] (/var/www/html/Vue/node_modules/neo-async/async.js:7974:18)
at options.error (/var/www/html/Vue/node_modules/node-sass/lib/index.js:294:32)
# ./src/material-dashboard.js 17:0-48
# ./src/main.js
# multi ./src/main.js
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-material-dashboard-pro#1.0.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-material-dashboard-pro#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-09-03T09_29_01_030Z-debug.log
Additionally, I have tried running npm rebuild node-sass, updated the material-dashboard.css file to include the underscore: _material-dashboard.css, passing --production in npm install --production, but am having no luck.
nodejs version: v8.11.4
npm version: v5.6.0
I've been trying to solve this for a few hours now but am not having any luck. I don't understand why it works locally but not when on another production machine.
This happens because of a spelling mistake (wrong case) in the import statement of this Vue UI library. The file is named "fullcalendar" while the import is called by "fullCalendar" (notice the capital "C"). When you fix this (make the capital "C" simple in the import statement) it will run the "npm run prod" command successfully. It should be noted that, for me, this did not occur in the windows environment for some reason, but only occurs in the Linux environment.

netcdf doesn't work in Node.js program

I'm trying to encode a NetCDF file in Node.js program, by using the netcdf(https://www.npmjs.com/package/netcdf) library.
Now, once I run a program, I get an error below.
C:\app [master +2 ~1 -0 !]> npm start
> spaceapps#1.0.0 start C:\app
> node server.js
C:\app\node_modules\text-encoding\lib\encoding.js:979
throw TypeError('Called as a function. Did you forget \'new\'?');
^
TypeError: Called as a function. Did you forget 'new'?
at TypeError (native)
at Object.TextDecoder (C:\app\node_modules\text-encoding\lib\encoding.js:979:13)
at Object.<anonymous> (C:\app\node_modules\netcdf\util\readbinary.js:4:40)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\app\node_modules\netcdf\util\type.js:4:14)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\Nodist\\v\\nodev5.9.1\\node.exe" "C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v5.9.1
npm ERR! npm v3.8.7
npm ERR! code ELIFECYCLE
npm ERR! spaceapps#1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spaceapps#1.0.0 start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the spaceapps package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs spaceapps
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spaceapps
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\app\npm-debug.log
C:\app [master +3 ~1 -0 !]>
It seems there is an error in a library.
I appreciate if someone tells me a solution for it.
As the developer said, He has no plans in the short or medium term to continue development, so you could consider use netcdfjs, that it's a javascript library that allows to read NetCDF v3 files. Because it's a NodeJS package you can run it server side, and for regular size files you can read it online, here you have an example.

Categories

Resources