npm run production: Error: Cannot find module './Webpack4Cache' - npm

I keep on getting this error every time I try to run npm run production on the freshly deployed laravel project:
Error: Cannot find module './Webpack4Cache'
I'm deploying to Ubuntu droplet - any idea how to resolve this issue?
CPU usage also goes over 100% when this npm script is running.

Related

Why am I getting 'Cannot GET' in localhost for Vue npm run serve

I installed Vite build tool for Vue and when I ran it (npm run serve), I got an error that generated the following message
"Missing script: "serve"".
After a little research, I learned that my package.json was missing the serve key.
After I added it ("serve": "vite preview") and ran it, I received the following error in the browser
"Cannot GET /"
preview is for when your app is already built (with npm run build), it's to check the static result. At the end, serve is the name that was used with Vue2's CLI for preview.
If you want to work locally with it, simply run npm run dev.
More info available on Vite's documentation.

What causes the npm error {errno: -4094, code: 'UNKNOWN', syscall: 'readlink'}?

I have been happily building a next.js app over the last couple days without error. Today I installed the firebase npm and suddenly I am getting a strange error when I try to run "npm run dev?
ready - started server on 0.0.0.0:3002, url: http://localhost:3002
[Error: UNKNOWN: unknown error, readlink 'C:\...\seo-site\.next\server\pages\_document.js'] {
errno: -4094,
code: 'UNKNOWN',
syscall: 'readlink',
path: 'C:\\...\\seo-site\\.next\\server\\pages\\_document.js'
}
Even if I uninstall firebase and roll the entire project back to a working build I still get the same error. If I try to run this "broken" build on another computer with the same version of node and npm it runs completely fine. I've tried running npm cache clean --force and npm install -g npm#latest --force several times without any luck.
I have noticed that as I change things I get the error with a different path. Sometimes it's \webpack-runtime.js sometimes its \errors.js and somethimes it's \pages\_document.js'
I cant find anything online or on stack overflow for an error matching this errno or syscall. Has anyone experienced this before or know what is causing this?
deleting the .next file and running npm run dev fixed the issue. I am not sure why this worked but I think it has something to do with next.js trying to use parts of a previous build when you make updates that are causing errors. deleting folder forces next to rebuild everything again.
I tried to go back directories from command line and then reentered into the workplace directory and tried npm run dev. Worked for me.
Right-click the project folder and from the menu choose "Open in integrated Terminal". Then try to run "npm run dev". If it still doesn't work, go back one folder with the command "cd .." and then go back again to the project folder with "cd project folder name". Try running "npm run dev". It worked for me on both occasions. Hope this helps.
Solved by restarting VS Code 🤔
Error occurred seemingly out of nowhere, when restarting the local server with 'npm run dev'. Just doing minor CSS changes to a component in the Nextjs project.

npm run serve or bulid fails on linux, but fine on Windows

Has anyone seen this error that has just started happening on my linux box? npm run serve and npm run build both run fine on my Windows machine as usual, but, as of yesterday, I get the following error on the linux box.
The code is the same (pulled from the git repo) and npm install is run before npm run serve or npm run build
Any ideas how I can track this down?...
root#agilesimulations:/usr/apps/socket-test# npm run serve
> socket-test#0.1.0 serve
> vue-cli-service serve --port 8098
INFO Starting development server...
98% after emitting CopyPlugin
ERROR Failed to compile with 1 error 3:38:16 PM
error in ./src/main.js
Syntax Error: Error: Cannot find module '#eslint/eslintrc'
# multi (webpack)-dev-server/client?http://localhost:8098&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

How to resolve clipboard error while deploying vuejs app on ubuntu server

I am deploying a vuejs app on my server.we have EC2 instance with ubuntu 16.04,As of now I am just deploying my test project but when I go running serve command like sudo serve -s dist but it is throwing an error which is: ERROR: Cannot copy to clipboard: Command failed: xsel --clipboard --input
xsel: Can't open display: (null)
: Inappropriate ioctl for device
I don't know this error is caused by ubuntu or vuejs please help me solve it.
I have followed these cammands so far.
First installed vue cli using
npm install -g #vue/cli
Then created a hello world app using
vue create helloWorld
Now run serve command
npm run serve
It was showing me a message like:
App running at:
- Local: http://localhost:8081/
- Network: http://172.31.16.66:8081/
Now i have created a build to run an app on the production server
npm run build
So my build was created successfully
i run command to run the app on the live server
serve -s dist
And it is throwing an error which is not solving by me so far
WARNING: Checking for updates failed (use--debugto see full error)
ERROR: Cannot copy to clipboard: Command failed: xsel --clipboard --input
xsel: Can't open display: (null)
: Inappropriate ioctl for device
I am also attaching screenshot below.
As you can see, there is an X11 dependency with the serve module - which means you need an xserver(display) for it to work.
Alternatively, (highly recommended) you could use a high performance HTTP server like nginx, apache etc. instead.
All you need is to copy your dist folder to your instance, and point your virtual server block to the dist dir, and restart your HTTP server - BAM! you're up and running.
Cheers!
I had the same issue and I solved it by adding "-n" option to serve.
"-n, --no-clipboard Do not copy the local address to the clipboard"

NPM not available when running installation script

I have an interesting issue, I have a setup or rails project and the deployment/upgrades works absolutely fine when running as a dedicated user (deploy) who is used to setup everything.
I am using codeDeploy to manage the deployments and it uses root user to do the deployment on AWS, but during the deployment it fails on running the same script because it's not able to find npm command
cd client && npm run build:client
sh: 1: npm: not found
rake aborted!
Command failed with status (127): [cd client && npm run build:client...]
If i run it manually to check that i also get nothing
root#ip-172-31-4-141:/home/ubuntu# su deploy -c "which npm"
root#ip-172-31-4-141:/home/ubuntu#
NPM is available via the deploy user but I am struggling to understand why it's not available via the root user
deploy#ip-172-31-4-141:/home/ubuntu$ which npm
/home/deploy/.nvm/versions/node/v7.8.0/bin/npm
Any help to get this resolved would be great.
Thanks,
The issue here was that AWS CodeDeploy when starts deployment loads only a minimum env; to load all the env variables I have exported the env and then in the deploy phase source that file, which resolves my issue