Any ideas about the following errors?
C:\PGM\_CODE\zui>npm install -g jspm
C:\PGM\devel\node-v7.2.1-win-x64\jspm -> C:\PGM\devel\node-v7.2.1-win-x64\node_m
odules\jspm\jspm.js
C:\PGM\devel\node-v7.2.1-win-x64
`-- jspm#0.16.53
C:\PGM\_CODE\zui>gulp watch
Index generation: 83.257ms
module.js:472
throw err;
^
Error: Cannot find module 'jspm'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\PGM\_CODE\zui\build\tasks\export-release.js:7:14)
Well, funny enough I had this problem in 2017 and ran into it again in 2019.
In 2019
So this time, in order to fix it: I removed the JS extension, and set a new node_modules path.
So in the command prompt I run:
SET NODE_PATH=D:\Users\bakopme\AppData\Roaming\npm\node_modules
And I changed the command to be:
const jspm = require('jspm');
Previously, in 2017
I had hardcoded the path to the JS file.
Obviously this isn't the right way to do it but I am mentioning it in case the other does not work.
const jspm = require('/PGM/devel/node-v7.2.1-win-x64/node_modules/jspm/jspm.js');
Related
Tried to use npm start with Create React App to launch my react application, but got this error:
node:internal/modules/cjs/loader:943
throw err;
^
Error: Cannot find module './keywords'
Require stack:
- D:\social-ribbon\node_modules\ajv-keywords\index.js
- D:\social-ribbon\node_modules\webpack\node_modules\schema-utils\src\validateOptions.js
- D:\social-ribbon\node_modules\webpack\node_modules\schema-utils\src\index.js
- D:\social-ribbon\node_modules\webpack\lib\SourceMapDevToolPlugin.js
- D:\social-ribbon\node_modules\webpack\lib\WebpackOptionsApply.js
- D:\social-ribbon\node_modules\webpack\lib\webpack.js
- D:\social-ribbon\node_modules\react-scripts\scripts\start.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at Function.Module._load (node:internal/modules/cjs/loader:773:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (D:\social-ribbon\node_modules\ajv-keywords\index.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Module.require (node:internal/modules/cjs/loader:1012:19) {
requireStack: [
'D:\\social-ribbon\\node_modules\\ajv-keywords\\index.js',
'D:\\social-ribbon\\node_modules\\webpack\\node_modules\\schema-utils\\src\\validateOptions.js',
'D:\\social-ribbon\\node_modules\\webpack\\node_modules\\schema-utils\\src\\index.js',
'D:\\social-ribbon\\node_modules\\webpack\\lib\\SourceMapDevToolPlugin.js',
'D:\\social-ribbon\\node_modules\\webpack\\lib\\WebpackOptionsApply.js',
'D:\\social-ribbon\\node_modules\\webpack\\lib\\webpack.js',
'D:\\social-ribbon\\node_modules\\react-scripts\\scripts\\start.js'
]
}
Someone suggested searching for a file called "keywords", but that word only appears in files as part of ajv-keywords or css-color-keywords. Someone else advised reinstalling the entire node-modules folder, but that sounds a bit drastic. I'm now asking you for help. Thanks for any help.
I also faced the same problem. What I did was removed the node modules folder and reinstalled it. I will also share the commands
rm -R node_modules
npm cache --force clean
npm cache --force clear
npm install
npm start
Hope this works. It worked form me, but in my case, there was a folder of avj-keywords.
Assuming you import it as "Keywords",
Change import Keywords from './keywords' to import Keywords from 'keywords'
You don't need to use relative paths when importing packages from node_modules.
After adding 'ytdl-core' to node_module in files. I tried to use it for a discord bot by requiring (const ytd1 = require('ytd1-core');) but it errors and does this:
module.js:538
throw err;
^
Error: Cannot find module 'ytd1-core'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\David\Documents\Discord Bot\discordbot.js:14:14)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
I tried looking up fixes, in my terminal I used npm install ytdl-core, yarn add ytdl-core and nothing happened. The folder does exist with no pop up error.
The bot can find the discord.js file in the node_module but not ytdl-core. I don't know if it didn't install right, if I have to do something manually, or make it a global file.
As #Antony mentioned, I think you've made a typo error. There is no library called ytd1-core. Update your require with:
const ytdl = require('ytdl-core');
Try installing ytdl package with npm i ytdl-core.
You wrote const ytd1 = require('ytd1-core') but that package doesn't exists. You need to install the package called 'ytdl-core'. Then you need to require the package with const ytd1 = require('ytdl-core')
Error: Cannot find module 'amqplib/callback_api'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
at Function.Module._load (internal/modules/cjs/loader.js:475:25)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object.<anonymous> (C:\Users\hello\Downloads\Private-Chat-App-Socket.io-
master\Private-Chat-App-Socket.io-master\app.js:3:9)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
I have tried to solve the error by installing amqp using npm but it does not work and i have also searched for solutions on the internet but no luck.
Pic of the error
I just noticed you're declaring amqp twice. In line 3 and 6:
var amqp = require('amqplip/callback_api'),
So I will suggest you check your code and choose the one you'll wanna use.
That aside, I think what you're trying to use is amqplib and not amqp
To resolve your problem, I will suggest you delete the node_modules dir completely, then run npm install, after which you run these:
npm install --save amqplib
This should solve your problem.
I have recently installed nodejs and npm on windows. Everything is fine with it. However, for some reason npm does work in cmd, but gives the following error when called on git-bash.
module.js:327
throw err;
^
Error: Cannot find module 'B:\b\programma's\Nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
module.js:327
throw err;
^
Error: Cannot find module 'B:\b\programma's\Nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
I noticed that the path apears to be B:\b\, meaning that somewhere npm selects the drive twice.
I am aware of the fact that my question looks a lot like this question. I did check my windows PATH variable, and the nodejs folder(including npm folder) are in there.
I also saw this post, and the git-bash does not tell me that npm is not found
I hope someone can help me with this problem
Looks like one of your directories has a ' in it. I would back everything up, change that directory to something simple like prog without any punctuation, uninstall Node and git-bash, and very carefully follow the instructions reinstalling them.
I am trying to deploy a node app that runs fine on my local Mac Lion, however. On the virtual Ubuntu box, it is giving an error:
module.js:340
throw err;
^
Error: Cannot find module '../lib/review'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/websites/Node_apps/min-driver-node/routes/reviews.js:2:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
There is my own custom modules in ./lib folder that are 'require' from the routes as following:
var Review = require('../lib/review');
What have I tried?
Ensured the same Node.js version running via
nvm(https://github.com/creationix/nvm)
Removed node_modules just to
re-install them by running "npm install"
Why is the 'require' unable import the custom modules from 'lib' folder on Server while works on Mac? Thank You
Try using the complete path to the file instead of using the relative path (../).
It looks like the 'require' module is case sensitive on Ubuntu but not on Mac....all my modules in lib folder starts with upper case(i.e. lib/Review.js), but when required in other parts of the code, it is lower case - require('../lib/review'). This is causing issue on Ubuntu but not on Mac lion. By updating the code to 'require('../lib/Review'), solves the problem
Is this a bug and i should be reporting this?
Try set file permissions chmod -R 744 '../lib/review'