How to resolve npm unmet dependency? - npm

Problem
My web app uses Sequelize ORM along with ExpressJS for serving the back end and Handlebars templating on the front end.
Everything used to work fine but now I'm not able to run the server app due to an unmet dependency error.
Specifically, Sequelize has a dependency on uuid#^8.1.0 that I cannot seem to resolve.
I am familiar with NPM and Node as well as the other packages I am using and cannot resolve this dependency for the life of me.
What I Have Tried
Installing Sequelize and UUID packages globally using the command:
npm install -g sequelize
npm install -g uuid
I've also tried installing a Node package specifically made to resolve tricky npm dependency issues called 'npm-install-missing'. This also did not resolve the issue.
I've also tried 'npm upgrade' but receive an error stating that uuid is outside the uuid package which I do not understand. Here is the resulting error from running 'npm upgrade':
C:\Users\benar\Documents\Dev\Test\NodeExpress\testwebproject>npm upgrade
npm ERR! code EEXIST
npm ERR! path C:\Users\benar\Documents\Dev\Test\NodeExpress\testwebproject\node_modules\.bin\uuid
npm ERR! Refusing to delete C:\Users\benar\Documents\Dev\Test\NodeExpress\testwebproject\node_modules\.bin\uuid: is outside C:\Users\benar\Documents\Dev\Test\NodeExpress\testwebproject\node_modules\uuid and
not a link
npm ERR! File exists: C:\Users\benar\Documents\Dev\Test\NodeExpress\testwebproject\node_modules\.bin\uuid
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\benar\AppData\Roaming\npm-cache\_logs\2020-08-08T19_18_39_086Z-debug.log
C:\Users\benar\Documents\Dev\Test\NodeExpress\testwebproject>
Someone left a comment with the suggestion to uninstall both sequelize and uuid then install uuid and sequelize again in that order. After doing this, I attempted to run my app again and received the following error which I'm fairly certain is the same as before:
C:\Users\benar\Documents\Dev\Test\NodeExpress\testwebproject\node_modules\uuid\dist\esm-browser\index.js:1
export { default as v1 } from './v1.js';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1172:16)
at Module._compile (internal/modules/cjs/loader.js:1220:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Module.load (internal/modules/cjs/loader.js:1105:32)
at Function.Module._load (internal/modules/cjs/loader.js:967:14)
at Module.require (internal/modules/cjs/loader.js:1145:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (C:\Users\benar\Documents\Dev\Test\NodeExpress\testwebproject\node_modules\sequelize\lib\utils.js:7:16)
at Module._compile (internal/modules/cjs/loader.js:1256:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
[nodemon] app crashed - waiting for file changes before starting...
What else can I try to fix this issue?

Related

next.js - how to fix issue with npm run build

I have a project on a test server which I am able to deploy successfully with npm run build
Now I am trying to deploy it on the production server but I am getting the following error:
/home/clients/7cb14b18a04cde30fa48b73997f5d66d/sites/americanmarket.ch/node_modules/next/dist/telemetry/storage.js:101
notify = ()=>{
^
SyntaxError: Unexpected token =
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/clients/7cb14b18a04cde30fa48b73997f5d66d/sites/americanmarket.ch/node_modules/next/dist/build/index.js:37:16)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! american-market#0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the american-market#0.1.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! /home/clients/7cb14b18a04cde30fa48b73997f5d66d/.npm/_logs/2022-12-29T10_34_13_423Z-debug.log
What I tried to do to fix the issue was to check the versions for packages like next, react and react-dom on the test server and use the exact same versions in the package.json for the prod server. I deleted the node_modules folder and package-lock.json file I tried an npm install and npm run build again but I still got the same error.
At this point I'm not too sure how I can fix this issue.
Hi #Jolan,
It is hard to tell you what cause this error message. But, There are a few things.
It's possible If you are using a version of Node.js that is older than the version that you used on the test server, certain features of your code that are supported in newer versions of Node.js may not work in the older version. This could cause syntax errors or other issues when you try to run your code. First, try to run this command and see if Babel able to transpile your code successfully, babel src --out-dir build. Then check node version by run that node -v.
Most of the time I see the issue could be related to Babel, which is a JavaScript transpiler that allows you to use newer JavaScript syntax in older environments. If you are using Babel in your project, and you are seeing syntax errors like Unexpected token =, it could be because Babel is not correctly transpiling your code.
Maybe you need to clear the NPM cache and then run NPM install again.
npm cache clean --force.
If you are still unable to resolve the issue, then, you need to check the logs for more infomation.
As Mr.#Canberk Sahin described.
Can you check the debug log from here /home/clients/7cb14b18a04cde30fa48b73997f5d66d/.npm/_logs/2022-12-29T10_34_13_423Z-debug.log

Vue 2 app, pull down latest, getting error, workign for everyone else

I've got a vue 2 project.
Other folks get latest in TFS and it works, only failing on my box
I deleted the old folder, force get currrent version, cd to src folder, Npm install, npm run serve
Get this error.
10 warnings found. INFO Starting development server... ERROR
Error: #vitejs/plugin-vue requires vue (>=3.2.13) or #vue/compiler-sfc
to be present in the dependency tree. Error: #vitejs/plugin-vue
requires vue (>=3.2.13) or #vue/compiler-sfc to be present in the
dependency tree.
at Object. (D:\TFS\StudentPortal4Vue_1_1\clientapp\node_modules\vue-loader\dist\compiler.js:14:15)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (D:\TFS\StudentPortal4Vue_1_1\clientapp\node_modules\vue-loader\dist\index.js:8:20)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) npm ERR! code ELIFECYCLE npm
ERR! errno 1 npm ERR! student-portal#1.1.0 serve: vue-cli-service lint --fix && vue-cli-service serve --open npm ERR! Exit status 1 npm
ERR! npm ERR! Failed at the student-portal#1.1.0 serve 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\Brown.ericw\AppData\Roaming\npm-cache_logs\2022-03-07T18_01_49_062Z-debug.log
I compared the source, everything is the same, only the node folder is different
I got a copy of a coworkers local folder (Without node folders) working, did a compare by file looking for differences and testing.
Any idea what I'm doing wrong?
I figured it out, we have packages-lock.json checked in to source contorl. If I delete that before the "npm install" everything works as expected.
Going to remove it from source control.

ERROR Error: Cannot find module '#xtuc/long'

I am learning vueJs, I have installed my project using CLI and by project has successfully installed, the problem come when i need to run my project via terminal with a command npm run serve, below is the error that occur after running the command
$ npm run serve
> school#0.1.0 serve C:\Users\Mr chomvu\Documents\vueproject\school
> vue-cli-service serve
INFO Starting development server...
ERROR Error: Cannot find module '#xtuc/long'
Error: Cannot find module '#xtuc/long'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Mr
chomvu\Documents\vueproject\school\node_modules\#webassemblyjs\wast-
printer\lib\index.js:10:36)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js
(internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! school#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the school#0.1.0 serve 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\Mr chomvu\AppData\Roaming\npm-cache\_logs\2019-
06-08T13_11_37_227Z-debug.log
I do expect after successfully compilation to have a local:
https://localhost:8080
I have attached the error image:
If you don't make any changes in project, just you trying to install and run your first vue.js app then follow this guide Creating a Project CLI, and everything will be fine.
Be sure you using the latest version of node & npm.
If you want to fix this project try remove node_modules and the package-lock.json file, and than run npm install

Error: Cannot find module '#angular/tsc-wrapped/src/tsc' ionicjs ionic view

I get following error when try to compile ionic 3 app with ionic-view (www.ionicjs.com)
Error: Cannot find module '#angular/tsc-wrapped/src/tsc'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (/usr/src/app/node_modules/#ionic/app-scripts/dist/aot/aot-compiler.js:7:13)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
npm info lifecycle MedMan#0.0.1~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! MedMan#0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the MedMan#0.0.1 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! /home/gitlab-runner/.npm/_logs/2017-09-25T14_14_22_583Z-debug.log
/snapshot.sh: line 32: [: missing `]'
npm run build failed
Make sure your project has a build script in the package.json
Failed to upload build to storage please retry your build.
Running after script...
$ clean-up
Cleaning up files...
Successful clean up
ERROR: Job failed: exit status 1
I work with following Versions:
"#angular/tsc-wrapped": "4.4.3",
"#ionic/cli-plugin-ionic-angular": "1.4.1"
"ionic": "3.12.0",
"rxjs": "^5.4.3",
"tslint": "^5.7.0",
"tslint-loader": "^3.5.3"
npm v 4.6.1
node v 8.5.0
None of the solutions at the web can solve this issue for me.
I guess this should fix it:
upgrade npm to the latest version (5.3.0), I personally stayed at 5.1.0 because there were issues with ionic and version 5.2.0 but I think it is fixed in the current version
rm -rf node_modules package-lock.json (on Windows: delete node_modules and package-lock.json manually)
npm install
If it still does not work you can try to manually install tsc-wrapped:
npm install --save-dev #angular/tsc-wrapped
Try this:
npm install npm#latest -g
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli#latest
npm install #angular/tsc-wrapped autoprefixer
https://github.com/angular/angular-cli/issues/3183#issuecomment-261740427
I additionally had to (but dont think this is only related to my case):
npm rebuild node-sass

Error: Cannot find module 'browser-sync'

When am trying to start gulp serve
Its raise an error
module.js:338
throw err;
^
Error: Cannot find module 'browser-sync'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/sajad/p_projects/my-project/gulpfile.js:17:19)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
After that i tried sudo npm rm browser-sync && npm install browser-sync
its raise follwing error
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "browser-sync"
npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! file
/home/sajad/.npm/escape-html/1.0.2/package/package.json npm ERR! code
EJSONPARSE
npm ERR! Failed to parse json npm ERR! No data, empty input at 1:1 npm
ERR! npm ERR! ^ npm ERR! File:
/home/sajad/.npm/escape-html/1.0.2/package/package.json npm ERR!
Failed to parse package.json data. npm ERR! package.json must be
actual JSON, not just JavaScript. npm ERR! npm ERR! This is not a bug
in npm. npm ERR! Tell the package author to fix their package.json
file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! /home/sajad/p_projects/my-project/npm-debug.log
Guide me how to start gulp serve and how resolve these error
I also had a same problem, I was able to solve it by entering this.
npm i browser-sync --save
Check this link here: https://github.com/brawlins/react-webpack-php-starter/issues/1
I tried these steps. Its work for me.
Globally install gulp.
Next need to install the project’s local dependencies (that’s where it’s looking for browser-sync). To do that,
cd into the project directory and run npm install.
Then try gulp serve.
You can also try following lines
npm i browser-sync --save then
npm start
You can try a :
npm cache clean
as it looks like it's not related to your project but your npm files,
and then re run npm install
Are you behind a proxy? Because it happened once to me in a company, this specific node module wouldn't be installed because of the proxy. I had to install it without proxy to make it work. Just try on your phone or another network.