I just installed node by cloning the git repo + make && make install. I then installed npm, and used npm to install express (seems like it fetches connect automatically since it's a dependency). However, when trying to start a simple express example i get the error message:
Error: Cannot find module 'connect/utils'
at Function._resolveFilename (module.js:219:11)
at Function._load (module.js:171:25)
at require (module.js:246:19)
at Object.<anonymous> (/home/yngve/local/node/lib/node/.npm/express/1.0.3/package/lib/express/response.js:16:13)
at Module._compile (module.js:302:26)
at Object..js (module.js:308:10)
at Module.load (module.js:234:31)
at Function._load (module.js:201:10)
at require (module.js:246:19)
at Object.<anonymous> (/home/yngve/local/node/lib/node/.npm/express/1.0.3/package/lib/express/index.js:52:1)
Seems someone has the same problem here: http://groups.google.com/group/express-js/browse_thread/thread/287086bd30f79cf1/adbb5c669872e45a
but the conclusion seems to be that one needs connect installed (which I have).
I've checked that I have the following files at least:
/home/yngve/local/node/lib/node/.npm/connect/0.5.8/package/lib/connect/utils.js
/home/yngve/local/node/lib/node/.npm/express/1.0.3/node_modules/connect/connect/utils.js
Anyone have a clue?
Resolved
Added
require.paths.unshift('<path_to_node>/lib/node/connect');
But the newest rev. is fixed, so this shouldn't really be necessary (see answer below).
It seems like it was a bug in express. Installing the latest version, 1.0.5, fixed this problem for me.
It sounds like you don't have your require path including your npm directory. Use require.paths to modify that.
Some more info:
http://jherdman.github.com/2010-04-05/understanding-nodejs-require.html
Related
I'm trying to run npm run gulp and I'm coming up with this primordials is not defined error (I have also added the npm-shrinkwrap.json file as suggested which gets updated after running npm install but it doesn't fix my primordials is not define error):
> gulp-tutorial#1.0.0 gulp
> gulp
fs.js:47
} = primordials;
^
ReferenceError: primordials is not defined
at fs.js:47:5
at req_ (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/natives/index.js:143:24)
at Object.req [as require] (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
Node.js v17.0.1
Any suggestions 🙌 ?
Primordials are used by Node.js internal modules and are not accessible to end user scripts. (That's their entire point for existing. Otherwise, you could modify Object.prototype and end up affecting Node.js internals, causing weird crashes and things like that.)
The module that is giving you this error is the natives module. The page for the package says:
This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs#4.x.
Sounds like it's at that point where it's broken. Use npm ls natives to find out what's using it. (You might need to be in the /Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main directory when you run the command.) From there, you can try to figure out how to get rid of it.
Another possibility would be to try downgrading to an earlier version of Node.js to see if it works with that version.
The problem was with the versions not matching up. I also had 2 NodeJS installation paths and that was throwing things off.
I uninstalled them all, started from the beginning and used brew to reinstall.
Then checked that the versions were all compatible.
I also had to install node-sass and referred to this compatibility table to get the correct version - https://github.com/sass/node-sass#node-version-support-policy
Now its working and I can get on developing :) As of today Im running Node v17.0.1 Npm v8.1.0 Gulp cli v2.3.0
I am trying to get CKEditor in my project with a custom build.
However, my problem is more general, so feel free to answer even if you don't use CKEditor.
Following the instructions to generate a custom build, I am getting a syntax error when running npm run build in terminal:
my/build/path/bin/create-entry-file.js:12
const { bundler } = require('#ckeditor/ckeditor5-dev-utils');
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:140:18)
at node.js:1043:3
Npm fails with a bunch of text and the above error. I believe this error is generated due to modern ECMAScript syntax, which is not recognized in my local machine.
However, the build I am trying to generate is there, complete and ready. Also, some other documentation of theirs, indicate more import {...} from syntax. This means that they are able to generate the build without the need of external packages (otherwise they would be in the package.json dependencies).
So, my question is, how do I install the software needed that will allow my npm to recognize and execute modern ES syntax ?
I am running on Ubuntu 16, with the lastest npm version: 5.6.0.
Thanks in advance, let me know if I can provide more information
Can you please check the version of Node on your computer?
Run in the terminal
node -v
You need to have at least 6.4 as your Node.js version according to this list on your computer
Here you have a link where you get and update to the newest version of Node 8.9.4 for different platforms. In your case check Linux
https://nodejs.org/en/download/
Has anyone been able to successfully install node-sass on IBM i?
I'm currently running Node 6.9.1, and am able to install many npm packages. However, the #angular/cli has a dependency on node-sass, and apparently, node-sass has a compiled component that is giving me grief to install.
My first issue had to do with being able to download the binary itself - because of our network setup, the IBM i was unable to download the binary from:
https://github.com/sass/node-sass/releases/download/v4.5.2/aix-ppc-48_binding.node
I was getting a timeout error. I was able to resolve that by changing the SASS_BINARY_SITE to the non-https version:
export SASS_BINARY_SITE='http://github.com/sass/node-sass/releases/download'
However, now, even though the binary downloads successfully, i get the following error when npm tries to test the binary:
Testing binary Binary has a problem: Error: Could not load module
/QOpenSys/QIBM/ProdData/OPS/Node6/lib/node_modules/node-sass/vendor/aix-ppc-48/binding.node.
The module has an invalid magic number.
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (/QOpenSys/QIBM/ProdData/OPS/Node6/lib/node_modules/node-sass/lib/binding.js:19:10)
at Object.<anonymous> (/QOpenSys/QIBM/ProdData/OPS/Node6/lib/node_modules/node-sass/lib/index.js:14:35)
And then npm tries to build the binary locally, but fails because Python2 isn't available on this machine. I can request the installation of Python2, which is a long process in our environment, but before i continue down that rabbit hole, I'd like to know if it's actually possible to have node-sass working, and if so, is there another binary that i can point the npm install at to use instead.
Or, is there an alternative means of get node-sass working?
As of 2017 this will likely not be possible. In addition to Python you will need the entire cpp toolchain to build node and node addons. Since this is already a very hard requirement for desktop PCs, systems like that will have a even harder time. Judging from their binding.gyp, there is just support for OS X, Windows and Linux.
node-sass is known to be hard to build also across the node use base.
Very likely you rather want to have a build / CI step on Linux that compiles your SASS files and builds your artefact.
After upgrading to Ember cli 2.12.1 I receive the following error, when trying to serve ember.
Cannot find module 'C:\Users\assaue\web\client\bower_components\ember\ember-template-compiler'
Error: Cannot find module 'C:\Users\assaue\web\client\bower_components\ember\ember-template-compiler'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Class.htmlbarsOptions (C:\Users\assaue\web\client\node_modules\emberx-file-input\node_modules\ember-cli-htmlbars\ember-addon-main.js:72:25)
at Object.toTree (C:\Users\assaue\web\client\node_modules\emberx-file-input\node_modules\ember-cli-htmlbars\ember-addon-main.js:31:43)
at C:\Users\assaue\web\client\node_modules\ember-cli-preprocess-registry\preprocessors.js:180:26
at Array.forEach (native)
at processPlugins (C:\Users\assaue\web\client\node_modules\ember-cli-preprocess-registry\preprocessors.js:178:11)
at module.exports.preprocessTemplates (C:\Users\assaue\web\client\node_modules\ember-cli-preprocess-registry\preprocessors.js:161:10)
Try updating below in package.json
"ember-cli-htmlbars-inline-precompile": "^0.3.6"
Maybe any one of your addons might expect ember to be installed through bower.
I think some of your addon listed in package.json requires ember js to be in bower directory. For my app, the addon was jquery-ui and it was referred as following.
templateCompilerPath = this.project.bowerDirectory + '/ember/ember-template-compiler';
Add
"ember": "2.13.0" ( Latest Version now )
in bower.json
Ember has moved ember package from bower to npm as ember-source, but still it doesn't work as expected because of third party addons
when you don't have ember package in bower.json.
You may get WARNING: Ember.js is now provided by node_moduleember-source, please remove it from bower in terminal when you run your ember app.
I am pretty sure that the problem is in the emberx-file-input module judging from your log.
at Class.htmlbarsOptions (C:\Users\assaue\web\client\node_modules\emberx-file-input\node_modules\ember-cli-htmlbars\ember-addon-main.js:72:25)
Key fragment is \emberx-file-input\node_modules\ember-cli-htmlbars
It doesn't have the correct ember-cli-htmlbars yet and hence it throws the error. Try to find the version of the emberx-file-input which has the correct dependency.
I've been able to get npm installed but there are a lot of things that don't seem to work.
My first question is what is going on here:
steven#steven-VirtualBox:~/Documents/node$ sudo npm install socket.io
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: No such module
at Object.<anonymous> (/usr/share/npm/lib/utils/output.js:8:21)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/usr/share/npm/lib/utils/log.js:21:14)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
I seem to end up here a lot (line 201).
This command works when I don't use sudo. But I don't know if it does what it should do.
Is npm written in javascript? Is there a way I can set it up manually?
Also, I seem to be getting different results running the curl http://npmjs.org/install.sh | sh command to install npm depending on what directory I am in. What directory should I be in when I run it? It's rather frustrating that I don't really know what these scripts are doing behind the scenes.
I find tons of tutorials. They all point back to the same instructions. I follow the instructions. They don't work.... Look for more tutorials.....
I got node.js to compile from src perfectly fine. Ran the benchmarks from there too. That should have been the hardest part!
Do you have an old npm? Deleting the one in usr/bin fixed this problem for me:
$ rm /usr/bin/npm
This is really weird.
Registry down ? DNS issue ?
Try to access this url: http://registry.npmjs.org/-/short
You may want to read the excellent faq here : http://npmjs.org/doc/faq.html
Can you install any other package ?
You also need node version > 0.4 to run npm.