My npm project has the esprima-six npm module as a transitive dependency. Recently, it has become impossible to download, as seen in the following output from npm install:
npm ERR! 404 Not Found
npm ERR! 404
npm ERR! 404 'esprima-six' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 It was specified as a dependency of 'syntax-error'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
On the npm site, esprima-six cannot be found:
https://www.npmjs.com/package/esprima-six
But Google's cache for the page shows that it used to exist: http://webcache.googleusercontent.com/search?q=cache:81uuMFHrDeMJ:https://www.npmjs.com/package/esprima-six+&cd=1&hl=en&ct=clnk&gl=uk&client=ubuntu
So why did the module become unavailable? And what is the best way to get my project building again?
Edit: in the end I updated the dependency which depended on esprima-six to a later version which didn't need it.
esprima-six has been unpushlished and is no more.
It's hard to track down what exactly has happened, but it seems that esprima-six was a module based on the unofficial harmony branch of the project that has been discountinoud in May 2015, following the deprecation of esprima-fb (a fork that added JSX syntax).
And now esprima-six is no longer needed, as Esprima 2.0 officially supports ES6.
What is the best way to get my project building again?
The stance of Ariya Hidayat, Esprima's maintainer, is that you should just switch to Esprima 2.x.
My project has the esprima-six npm module as a transitive dependency.
In that case, it's probably enough to update your direct dependency, they will have switched already.
Related
Goal: Trying to create a simple blog using Gatsby
Outcomes:
Expected Outcome: Things should go as defined in the tutorial guide
Actual Outcome: Getting Dependency tree error in step(s) & Also a warning message like 34 vulnerabilities (11 moderate, 23 high) whenever installing something using npm in this project
Approach: I am following the guide available here, & in Task install MDX transform plugin, getting the below error
Questions:
How do i resolve this particular dependency tree issue & Also in general how do i approach this kind(dependency tree issue) of errors in npm?
The warnings related to the vulnerable packages - How critical are those & How should it be handled ?
Command-used: npm install gatsby-plugin-mdx #mdx-js/mdx#v1 #mdx-js/react#v1
Output/Console Error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-gatsby-site#1.0.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"^18.1.0" from the root project
npm ERR! peer react#"^16.9.0 || ^17.0.0 || ^18.0.0" from gatsby-plugin-mdx#3.18.0
npm ERR! node_modules/gatsby-plugin-mdx
npm ERR! gatsby-plugin-mdx#"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.13.1 || ^17.0.0" from #mdx-js/react#1.6.22
npm ERR! node_modules/#mdx-js/react
npm ERR! #mdx-js/react#"v1" from the root project
npm ERR! peer #mdx-js/react#"^1.0.0" from gatsby-plugin-mdx#3.18.0
npm ERR! node_modules/gatsby-plugin-mdx
npm ERR! gatsby-plugin-mdx#"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See <home-folder>/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! <home-folder>/.npm/_logs/2022-07-06T15_46_56_149Z-debug-0.log
Updates:
Update 1:
After trying one of the suggestion given by the fellow stack-overflow site member, a new error is thrown! So ignoring the dependency tree issue with skip legacy tree is not working, Hence any more suggestion from any gatsby users!?
gatsby develop
ERROR #11901 COMPILATION
Failed to compile Gatsby files (Error):
Could not resolve module "#parcel/namer-default" from
"<home-folder>/codeSpace/siteByGatsby/sv3/my-gatsby-site/node\_modules/#gatsbyjs/parcel-namer-relative-to-cwd/lib/index.js".
not finished compile gatsby files - 0.778s
Not that "you should" normally do what i am about to suggest, but you can run:
npm install gatsby-plugin-mdx #mdx-js/mdx#v1 #mdx-js/react#v1 --legacy-peer-deps
Basically what this will do is tell npm that you wish to install peer dependencies, the reason this happens is because you are using React#18.2 in your project, but the packages you are trying to install are using a lower version of React. Thus, NPM is throwing you this error.
The reason why "you shouldn't" normally do this, is imagine theres a dependancy within a package that is flagged as vunerable, but you currently have a 'fixed' version of this installed. You would then be installing the peer dependency that could have a vulenarbility.
You can run the above code and be 'alright', its not a big deal that it is wanting to install lesser version of React.
But what you should also think about, is do you really need React#18.2, or could you use a downgraded version because, how likely are you to use any of the features that might be in the latest version release.
This is also a reason why a lot of developers don't just go and install the newest version of React when they are building projects, because you have to rely on packages that are maintained by either solo developers, or by a community of lovely people who are willing to help maintain a package to bring it up to speed with Reacts latest releases.
These are pretty much the main three things you can do:
You either install the legacy dependencies
You knock React down a version peg that is inline with the version required in the dependency tree for the packages you are looking to use
You find another package, or you take a look on their Github incase they have released a version, but not yet published this release to NPMjs yet
Hope this helps :)
Sidenote:
When migrating this project to a hosting provider, you will also need to tell them that you have packages that you have force installed with --legacy-peer-deps by either creating an environment variable for the site on the hosting providers platform, or with .npmrc file with the following:
legacy-peer-deps=true
Greatings,
a few months ago i created an app via create-react-app. This app did not run when i entered npm start. And i get the following error message:
react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"babel-loader": "8.1.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:
/Users/kevinmotzkus/Documents/projects/node_modules/babel-loader (version: 8.0.6)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "babel-loader" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if /Users/kevinmotzkus/Documents/projects/node_modules/babel-loader is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls babel-loader in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-loader.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! womd#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the womd#0.1.0 start 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! /Users/kevinmotzkus/.npm/_logs/2020-07-10T20_09_39_848Z-debug.log
I followed the steps, but it isn´t working. I dont know what to look for.
do i need to install package managements into the app folder? Im kinda new to react and coding so be patient and gentle please ^^
Im happy if you give me critic about my question too, is it understandable, do you need more or specific information?
You could delete the package-lock.json file and the node_modules folder and then run
npm install
Also, this is a pretty similar issue
Create React App requires a dependency: “babel-loader”: “8.1.0”
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"babel-loader": "8.0.5"
Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:
/Users/moeismail/node_modules/babel-loader (version: 8.0.6)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "babel-loader" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if /Users/moeismail/node_modules/babel-loader is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls babel-loader in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-loader.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! exported-from-react-studio#0.0.1 start: PORT=3000 react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the exported-from-react-studio#0.0.1 start 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! /Users/moeismail/.npm/_logs/2020-01-11T14_27_54_274Z-debug.log
The maintainers at angular2-universal have not updated their site:
Problem 1)
typings install node express body-parser serve-static express-serve-static-core mime --ambient
typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead
Problem 2)
typings install node express body-parser serve-static express-serve-static-core mime --global
typings INFO globaldependencies "express" lists global dependencies on "node" that must be installed manually
typings INFO globaldependencies "body-parser" lists global dependencies on "node" that must be installed manually
typings ERR! message Unable to find "node" ("npm") in the registry.
typings ERR! message However, we found "node" for 2 other sources: "dt" and "env"
typings ERR! message You can install these using the "source" option.
typings ERR! message We could use your help adding these typings to the registry: https://github.com/typings/registry
typings ERR! caused by https://api.typings.org/entries/npm/node/versions/latest responded with 404, expected it to equal 200
typings ERR! cwd /Users/davidmontgomery/Documents/frontend/green
typings ERR! system Darwin 15.6.0
typings ERR! command "/usr/local/bin/node" "/usr/local/bin/typings" "install" "node" "express" "body-parser" "serve-static" "express-serve-static-core" "mime" "--global"
typings ERR! node -v v4.5.0
typings ERR! typings -v 1.3.3
typings ERR! If you need help, you may report this error at:
typings ERR! <https://github.com/typings/typings/issues>
How do I resolve? I am using a mac.
The solution is to install node separately with the --global flag, because it's the only one that needs to be installed globally.
typings install dt~node --global
typings install dt~express dt~body-parser dt~serve-static dt~express-serve-static-core dt~mime
EDIT :
You don't need angular universal for server side rendering anymore, as it is now part of angular core.
As of version 1.0 TypeScript Definition Manager made some updates ([see here][1]) which included deprecating the --ambient flag.
Usages of ambient are now global
That means in typings.json any ambientDependencies should be renamed globalDependencies and any ambientDevDependencies should be
renamed globalDevDependencies.
It also means --ambient is now --global
...
=> For more information, check this out.
[typings github]: https://github.com/typings/typings
[original answer]: Ambient flag is deprecated
Thus, you should use this pattern ↓
typings install dt~PackageName --save --global
ex) typings install dt~body-parser --global --save
Comment below, if you need more help.
With a couple of things changing across typescript and the universal team working overtime to updating universal to the latest releases of angular rc5 and rc6, things have fallen a bit behind on the documentation front.
If you want to get started quickly, checkout out the universal starter kit at https://github.com/angular/universal-starter that should work for you.
I recently installed Node.js on a fresh Linode box, and I think I'm in a weird situation where I can't use require() to load any third party modules.
I've installed npm and have successfully installed modules via npm, but whenever I try to require one of the modules (or just some of my own code in the same directory), Node.js throws an error saying it can't find the module.
Any thoughts as to why this might be happening?
Here's an example error message:
root#li200-141:/home/mike# npm install sequelize
npm ERR! sudon't!
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm info it worked if it ends with ok
npm info version 0.2.2
npm info fetch http://registry.npmjs.org/sequelize/-/sequelize#0.4.2.tgz
npm info install sequelize#0.4.2
npm info activate sequelize#0.4.2
npm info build Success: sequelize#0.4.2
npm ok
root#li200-141:/home/mike# node
> var n = require('sequelize').Sequelize
Error: No such native module sequelize
at requireNative (node.js:83:32)
at cwdRequire (repl:27:10)
at [object Context]:1:9
at Interface.<anonymous> (repl:96:19)
at Interface.emit (events:27:15)
at Interface._ttyWrite (readline:295:12)
at Interface.write (readline:132:30)
at Stream.<anonymous> (repl:77:9)
at Stream.emit (events:27:15)
at IOWatcher.callback (net:489:16)
Apparently, there is a bug in node v0.2.2 that prevents require from working properly from the REPL.
Try putting your code in a .js file instead. That worked for me.