Cannot find module '/Users/dq212/node_modules/#schematics/angular/application'
Error: Cannot find module '/Users/dq212/node_modules/#schematics/angular/application'
at Function.Module._resolveFilename (module.js:469:15)
at Function.resolve (internal/module.js:27:19)
at new ExportStringRef (/usr/local/Cellar/angular-cli/1.4.6/libexec/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/export-ref.js:15:32)
at NodeModulesEngineHost._resolveReferenceString (/usr/local/Cellar/angular-cli/1.4.6/libexec/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/node-module-engine-host.js:61:21)
at NodeModulesEngineHost.createSchematicDescription (/usr/local/Cellar/angular-cli/1.4.6/libexec/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/file-system-engine-host-base.js:151:34)
at SchematicEngine.createSchematic (/usr/local/Cellar/angular-cli/1.4.6/libexec/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/src/engine/engine.js:82:40)
at CollectionImpl.createSchematic (/usr/local/Cellar/angular-cli/1.4.6/libexec/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/src/engine/collection.js:11:29)
at Object.getSchematic (/usr/local/Cellar/angular-cli/1.4.6/libexec/lib/node_modules/#angular/cli/utilities/schematics.js:40:23)
at Class.run (/usr/local/Cellar/angular-cli/1.4.6/libexec/lib/node_modules/#angular/cli/tasks/schematic-get-options.js:12:40)
at Class.beforeRun (/usr/local/Cellar/angular-cli/1.4.6/libexec/lib/node_modules/#angular/cli/commands/new.js:90:31)
I installed nvm, node, angular-cli, and typescript. When I try
ng new projectName
I get the above error. I'm new to a lot of these tools, but I did put in a ton of time looking for this error, not getting anywhere. Any help is appreciated.
I'm on Mac Sierra 10.12.6
I think you are using private npm registry and some of the libraries are blocked there.
you can see the npm registry by command npm get registry and it should give you https://registry.npmjs.org/
if you are getting something else, you can change that by git config set registry https://registry.npmjs.org/ to set it to public.
This is fixed. Somehow must have copied over, a node_modules folder into my user folder and not in my project directory. Silly oversight, colossal waste of time to figure out. Lesson learned. Conflicting folder caused lots of other Strange errors. Thank you.
Lesson, before re-installing the world, go to step one first.
Related
I am new to react-native and have found an error that makes absolutely no sense to me.
I am trying to include a calendar library: https://github.com/wix/react-native-calendars
I have included the dependency for that library in my package.json file and run npm install
The project was running fine and as expected. I have simply added one line of code to the project:
import { Calendar, CalendarList, Agenda } from 'react-native-calendars';
Nothing else. However now I am getting a red error message when the app loads on device and this is what my console is saying:
error: bundling failed: Error: While trying to resolve module xdate
from file
/Users/Alex/Documents/workspace/mobile/node_modules/react-native-calendars/src/index.js,
the package
/Users/Alex/Documents/workspace/mobile/node_modules/xdate/package.json
was successfully found. However, this package itself specifies a
main module field that could not be resolved
(/Users/Alex/Documents/workspace/mobile/node_modules/xdate/src/xdate.js.
Indeed, none of these files exist:
*
/Users/Alex/Documents/workspace/mobile/node_modules/xdate/src/xdate.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)
*
/Users/Alex/Documents/workspace/mobile/node_modules/xdate/src/xdate.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)
at ResolutionRequest.resolveDependency (/Users/Alex/Documents/workspace/mobile/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:103:15)
at DependencyGraph.resolveDependency (/Users/Alex/Documents/workspace/mobile/node_modules/metro/src/node-haste/DependencyGraph.js:272:4579)
at dependencies.map.relativePath (/Users/Alex/Documents/workspace/mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:376:19)
at Array.map ()
at resolveDependencies (/Users/Alex/Documents/workspace/mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:374:16)
at /Users/Alex/Documents/workspace/mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:212:33
at Generator.next ()
at step (/Users/Alex/Documents/workspace/mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:313)
at /Users/Alex/Documents/workspace/mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:297:473
at
However I have checked in the directory and in fact /Users/Alex/Documents/workspace/mobile/node_modules/xdate/src/xdate.js does exist. However I do not see any of this part: (.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
As to how /Users/Alex/Documents/workspace/mobile/node_modules/xdate/src/xdate.js/index can exist, that doesn't make sense because xdate.js is not a directory.
Any help?
It Usually happens if you try to install a module while your packager is open.
Try to delete node_modules folder and close the packager.
Then reinstall everything by npm install in your project directory.
First close your JavaScript bundler (Metro bundler in my case) and restart the application. This will create fresh dependency graph. This should solve the issue.
Just restart the bundler - no need to delete the Node Modules folder
I came across this issue when adding and using react-native-elements when using VS Code and Android Studio emulator on Linux Mint
In VS Code I had a terminal running Expo with Metro Bundler via 'npm start' command. After installing the react-native-elements in the folder (using 'npm install --save react-native-elements') and adding the import into the .js file I got the "However, this package itself specifies a main module field that could not be resolved" error.
In my case, this just involved a ^C in the terminal session to stop the Metro bundler and then running 'npm start' again. There was no need to delete the node modules folder at all.
If you're still getting the error even after deleting the ./node_modules folder and running npm install again, try doing the install with the --update-binary flag, i.e npm install --update-binary. This should clear out and rebuild any previously built packages on your machine.
Please don't delete the node modules folder.
The bundler has least to deal with node modules folder.
Instead close all the terminals. If using VS-code close that also.
Close all the local host server ports and if possible restart the system.
This might solve the issue.
If anyone have same issue, and remove node_module not working. Then you can try remove all node_module, package lock and using yarn to install node_module instead npm. Hope this help
None of the solutions above helped me except for restarting my MacBook. Wasted 30 minutes trying to fix this issue as I couldn't believe restarting my computer could be a solution.
I installed node.js with the windows installer. The folder structure formed is C:\Program Files\nodejs\node_modules\npm\node_modules. The last node_modules has all the module folders I guess.
I use the node.js command prompt to execute my js script. When the script is on Desktop, it executes all fine. When I shift my script to another folder in my C: it gives the error. I don't want to give the absolute path as it will have to be changed again and again. Anyways, what path should I give as absolute to make it just work
Error: Cannot find module 'curl'
at Function.Module._resolveFilename (module.js:489:15)
I have gone through the resolutions mentioned in other discussions. Have made the NODE_PATH environment variable. Have edited PATH variable to make it C:\Program Files\nodejs and not C:\Program Files\nodejs\. Have executed npm install -g npm and nothing seems to work.
Sorry for the trouble, if anyone has already started looking into it. I found the solution. In the node.js command prompt, in the project folder I executed the following 'npm install curl' which downloaded the curl packages into a node_modules folder in the folder which has my script. I anyways wonder, then how it worked when I had placed my project on Desktop. It seems that the way node.js finds modules has to be checked. FYI - I have not set the NODE_PATH and the path still has C:\Program Files\nodejs\ after I freshly installed it. Thank you!
I am using cheerio module for web scraping . It require htmlparser2 module , after installing htmlparser2. it gives following error-
Error: Cannot find module 'entities/lib/decode_codepoint.js'
Use this in your terminal:
npm install grunt-contrib-jshint --save-dev
Seen here:
https://www.npmjs.com/package/grunt-contrib-jshint
Below is applicable to Windows environment only, not Linux.
I received the same error when I tried to build jquery from source on Windows. It turns out that jsdom and/or grunt-contrib-jshint (both of which depend on htmlparser2) require gyp and for gyp to work you need a c++ compiler and python. I thought that I had them but turned out, that python need to be version 2.x not version 3.x. If it is 3.x it gives you a proper error on the first run (that I missed) and on subsequent runs you are getting the error in the question above which makes you wonder what's going on.
So I uninstalled python 3.x, installed python 2.x (don't forget make sure that python.exe is in your path), then deleted the node_modules folder in the project root and ran the build again.
This time around it worked. I'm not sure if this solves the OP question, but I hope it helps someone.
I recently wanted to update to Meteor 0.6.1 from 0.5.4 and just did a meteor update in terminal. Immediately got an error in my terminal that gets thrown basically when I try anything.
/Volumes/Macintosh HD/Users/martijn/.meteor/meteor: line 35: cd: /Volumes/Macintosh: No such file or directory
module.js:340
throw err;
^
Error: Cannot find module '/Volumes/Macintosh HD/Users/martijn/tools/meteor.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
I removed all of Meteor for a complete reinstall:
rm /usr/local/bin/meteor
rm -rf /usr/local/meteor
curl https://install.meteor.com | /bin/sh
Same error when I try to create a Meteor project in my Sites directory. Can't figure out whats causing this, it used to work great in my Sites directory. The only way to avoid this error is to paste all the docs, examples, packages, scripts and tools folders into my /Volumes/Macintosh HD/Users/martijn/ directory along with my projects which is very messy.
Was thinking that it might have to do something with that I'm running two harddrives in my Macbook, an SSD for the OS and HDD for my documents. /usr/local/bin where meteor gets installed is on my SSD. This seems to me like something is off with the paths of the installation, any ideas?
Thanks
This seems to have been a bug in how we escape directory names. You hit this because your home directory has a space in it ("Macintosh HD"). I believe I fixed this just now, and the fix should be released in 0.6.2: https://github.com/meteor/meteor/commit/c059c384fdf9e7169f25cc36d86fbc0ed0a9da83
I had this same issue. Luckily I had another computer with Meteor where the upgrade worked. So here is what I did:
I noticed that usr/local/bin had very different files in the working and not working computer. So I just copied all the files from the working computer into the non-working one. Now meteor works on both. Not sure it's the best approach, but solved my issue. Meteor commands work once more.
Hope this helps,
Paul
I have got a Nodejs app on AppFog and want to connect to a ftp-server with this.
I did install it with npm install ftp using "Ruby Command Prompt"
This is the only code line:
var FTPClient = require('ftp');
Trying to start the app, it throws an error:
Skipping npm-support: npm-shrinkwrap.json is not provided
Which kind of server should I use or what's the problem?
Still doesn't start:
Starting Application 'test007': .
Error: Application [test007] failed to start, logs information below.
====> /logs/staging.log <====
# Logfile created on 2013-03-09 10:37:09 +0000 by logger.rb/25413
Installing dependencies. Node version 0.8.14
Installing ftp#0.2.9 from local path
Installing xregexp#2.0.0 from local path
Installing node#0.0.0 from local path
Installing nodejs#0.0.1 from local path
But no error is shown.
Thanks in advance
The quick fix is to type npm shrinkwrap, which will provide an npm-shrinkwrap file.
A shrinkwrap file fixes the exact versions of your dependencies, and the exact version of their dependencies, and so on. Without it, each usage of npm install could install different versions of the packages -- sometimes, just different bugfix versions (1.4.2 vs 1.4.3), but sometimes much greater differences. There's no guarantee that your code will work with different dependency versions (in fact it is not uncommon to break), so shrinkwrapping is a great idea for any production-level code.
If you want to 'unshrinkwrap', just delete the npm-shrinkwrap.json. You can re-shrinkwrap at any point.