I work with React v15.6.1 and Yarn and I have tried to start react app from the terminal, but when I execute command "yarn start" throw an error and not run the app
Log: yarn start
Starting the development server...
events.js:183
throw er; // Unhandled 'error' event
^
Error: watch /home/navastud/atom-workspace/intervijs/public ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at createFsWatchInstance (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/navastud/atom-workspace/intervijs/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
so I tried to execute the command 'npm install' but not indicated others errors.
Log: npm install
multicomp#0.1.0 /home/navastud/atom-workspace/intervijs
├─┬ eslint#5.2.0
│ ├── chalk#2.4.1
│ ├─┬ inquirer#5.2.0
│ │ └─┬ string-width#2.1.1
│ │ └─┬ strip-ansi#4.0.0
│ │ └── ansi-regex#3.0.0
│ ├─┬ js-yaml#3.12.0
│ │ └── esprima#4.0.1
│ ├─┬ strip-ansi#4.0.0
│ │ └── ansi-regex#3.0.0
│ └─┬ table#4.0.3
│ ├── UNMET PEER DEPENDENCY ajv#6.5.2
│ └── chalk#2.4.1
├─┬ eslint-config-equimper#2.2.2
│ ├─┬ babel-eslint#8.2.6
│ │ └─┬ #babel/code-frame#7.0.0-beta.44
│ │ └─┬ #babel/highlight#7.0.0-beta.44
│ │ └── chalk#2.4.1
│ ├─┬ UNMET PEER DEPENDENCY eslint#4.19.1
│ │ ├── chalk#2.4.1
│ │ ├─┬ espree#3.5.4
│ │ │ └─┬ acorn-jsx#3.0.1
│ │ │ └── acorn#3.3.0
│ │ ├── ignore#3.3.10
│ │ ├─┬ inquirer#3.3.0
│ │ │ ├── chalk#2.4.1
│ │ │ └─┬ strip-ansi#4.0.0
│ │ │ └── ansi-regex#3.0.0
│ │ ├─┬ js-yaml#3.12.0
│ │ │ └── esprima#4.0.1
│ │ └─┬ strip-ansi#4.0.0
│ │ └── ansi-regex#3.0.0
│ └─┬ eslint-plugin-class-property#1.1.0
│ └─┬ eslint#3.19.0
│ ├─┬ espree#3.5.4
│ │ └─┬ acorn-jsx#3.0.1
│ │ └── acorn#3.3.0
│ ├── ignore#3.3.10
│ └─┬ table#3.8.3
│ └─┬ string-width#2.1.1
│ └─┬ strip-ansi#4.0.0
│ └── ansi-regex#3.0.0
├── UNMET PEER DEPENDENCY react#15.6.2
├── UNMET PEER DEPENDENCY react-dom#15.6.2
└─┬ react-scripts#1.1.4
├─┬ autoprefixer#7.1.6
│ └─┬ postcss#6.0.23
│ └── chalk#2.4.1
├─┬ UNMET PEER DEPENDENCY eslint#4.10.0
│ ├── chalk#2.4.1
│ ├── eslint-scope#3.7.3
│ ├─┬ espree#3.5.4
│ │ └─┬ acorn-jsx#3.0.1
│ │ └── acorn#3.3.0
│ ├── ignore#3.3.10
│ ├─┬ js-yaml#3.12.0
│ │ └── esprima#4.0.1
│ └─┬ strip-ansi#4.0.0
│ └── ansi-regex#3.0.0
└─┬ sw-precache-webpack-plugin#0.11.4
└─┬ sw-precache#5.2.1
└─┬ update-notifier#2.5.0
├─┬ boxen#1.3.0
│ └── chalk#2.4.1
└── chalk#2.4.1
npm WARN optional Skipping failed optional dependency /react-scripts /fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.2.4
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.2.4
npm WARN optional Skipping failed optional dependency /webpack-dev-server/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.2.4
npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0 but none was installed.
npm WARN eslint-config-react-app#2.1.0 requires a peer of eslint#^4.1.1 but none was installed.
npm WARN eslint-loader#1.9.0 requires a peer of eslint#>=1.6.0 <5.0.0 but none was installed.
npm WARN eslint-plugin-import#2.8.0 requires a peer of eslint#2.x - 4.x but none was installed.
npm WARN eslint-plugin-jsx-a11y#5.1.1 requires a peer of eslint#^2.10.2 || ^3 || ^4 but none was installed.
npm WARN eslint-plugin-react#7.4.0 requires a peer of eslint#^3.0.0 || ^4.0.0 but none was installed.
npm WARN react-d3-speedometer#0.3.2 requires a peer of react#^0.14.7 || ^16.0.0 but none was installed.
npm WARN react-svg-gauge#1.0.8 requires a peer of react#^16.2.0 but none was installed.
npm WARN react-svg-gauge#1.0.8 requires a peer of react-dom#^16.2.0 but none was installed.
why this happens and how to resolve it?
It's difficult to say exactly why you have gotten this error, but if you remove the node_modules directory and reinstall every dependency it should work as expected.
rm -rf ./node_modules && npm install
The following command can be used:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Related
We use webpack-bundle-analyzer to visualize what is bundled in our application and optimize it.
It appears lodash is imported, among many other lodash.* package (those package are just small part of lodash), you can visualize lodash in red in the following screenshot:
In our package.json, we only have installed lodash.* modules, and in our sources we only import those module, we never import 'lodash' directly.
This is the result of npm ls lodash:
$ npm ls lodash
PassCulture#1.199.0 /home/dka/workspace/github.com/pass-culture/pass-culture-app-native
├─┬ #lingui/cli#3.13.2
│ └─┬ inquirer#7.3.3
│ └── lodash#4.17.21 deduped
├─┬ #react-native-community/eslint-config#3.0.1
│ └─┬ eslint-plugin-flowtype#2.50.3
│ └── lodash#4.17.21 deduped
├─┬ #sentry/react-native#4.1.2
│ └─┬ #sentry/wizard#1.2.17
│ ├─┬ inquirer#6.5.2
│ │ └── lodash#4.17.21 deduped
│ └── lodash#4.17.21 deduped
├─┬ #storybook/addon-a11y#6.5.3
│ ├─┬ #storybook/api#6.5.3
│ │ └── lodash#4.17.21 deduped
│ ├─┬ #storybook/csf#0.0.2--canary.4566f4d.1
│ │ └── lodash#4.17.21 deduped
│ └── lodash#4.17.21
├─┬ #storybook/addon-actions#6.5.3
│ ├── lodash#4.17.21 deduped
│ └─┬ telejson#6.0.8
│ └── lodash#4.17.21 deduped
├─┬ #storybook/addon-essentials#6.5.3
│ ├─┬ #storybook/addon-controls#6.5.3
│ │ └── lodash#4.17.21 deduped
│ └─┬ #storybook/addon-docs#6.5.3
│ ├─┬ #storybook/mdx1-csf#0.0.1-canary.1.867dcd5.0 invalid: "canary" from node_modules/#storybook/addon-docs
│ │ └── lodash#4.17.21 deduped
│ ├─┬ #storybook/preview-web#6.5.3
│ │ └── lodash#4.17.21 deduped
│ ├─┬ #storybook/source-loader#6.5.3
│ │ └── lodash#4.17.21 deduped
│ └── lodash#4.17.21 deduped
├─┬ #storybook/addon-interactions#6.5.9
│ ├─┬ #storybook/api#6.5.9
│ │ └── lodash#4.17.21 deduped
│ └─┬ #storybook/instrumenter#6.5.9
│ └─┬ #storybook/addons#6.5.9
│ └─┬ #storybook/api#6.5.9
│ └── lodash#4.17.21 deduped
├─┬ #storybook/react#6.5.3
│ ├─┬ #storybook/core#6.5.3
│ │ ├─┬ #storybook/core-client#6.5.3
│ │ │ ├─┬ #storybook/client-api#6.5.3
│ │ │ │ └── lodash#4.17.21 deduped
│ │ │ └── lodash#4.17.21 deduped
│ │ └─┬ #storybook/core-server#6.5.3
│ │ ├─┬ #storybook/core-client#6.5.3
│ │ │ └── lodash#4.17.21 deduped
│ │ └── lodash#4.17.21 deduped
│ ├─┬ #storybook/docs-tools#6.5.3
│ │ └── lodash#4.17.21 deduped
│ ├─┬ #storybook/store#6.5.3
│ │ └── lodash#4.17.21 deduped
│ ├─┬ babel-plugin-react-docgen#4.2.1
│ │ └── lodash#4.17.21 deduped
│ └── lodash#4.17.21 deduped
├─┬ #testing-library/jest-dom#5.16.2
│ └── lodash#4.17.21 deduped
├─┬ #welldone-software/why-did-you-render#6.2.3
│ └── lodash#4.17.21 deduped
├─┬ appcenter-cli#2.10.10
│ ├─┬ inquirer#8.2.0
│ │ └── lodash#4.17.21 deduped
│ └── lodash#4.17.21 deduped
├─┬ babel-core#6.26.3
│ ├─┬ babel-generator#6.26.1
│ │ └── lodash#4.17.21 deduped
│ ├─┬ babel-register#6.26.0
│ │ └── lodash#4.17.21 deduped
│ ├─┬ babel-template#6.26.0
│ │ └── lodash#4.17.21 deduped
│ ├─┬ babel-traverse#6.26.0
│ │ └── lodash#4.17.21 deduped
│ ├─┬ babel-types#6.26.0
│ │ └── lodash#4.17.21 deduped
│ └── lodash#4.17.21 deduped
├─┬ babel-plugin-styled-components#2.0.7
│ └── lodash#4.17.21 deduped
├─┬ flipper-plugin-react-query-native-devtools#3.0.0
│ └── lodash#4.17.21 deduped
├─┬ html-webpack-plugin#4.5.2
│ ├── lodash#4.17.21 deduped
│ └─┬ pretty-error#2.1.2
│ ├── lodash#4.17.21 deduped
│ └─┬ renderkid#2.0.7
│ └── lodash#4.17.21 deduped
├─┬ jest#26.6.3
│ └─┬ #jest/core#26.6.3
│ └─┬ jest-config#26.6.3
│ └─┬ jest-environment-jsdom#26.6.2
│ └─┬ jsdom#16.7.0
│ ├─┬ data-urls#2.0.0
│ │ └─┬ whatwg-url#8.7.0
│ │ └── lodash#4.17.21 deduped
│ └─┬ whatwg-url#8.7.0
│ └── lodash#4.17.21 deduped
├─┬ optimize-css-assets-webpack-plugin#5.0.8
│ └─┬ last-call-webpack-plugin#3.0.0
│ └── lodash#4.17.21 deduped
├─┬ react-native-calendars#1.1284.0
│ └── lodash#4.17.21 deduped
├─┬ react-native#0.68.2
│ ├─┬ #react-native-community/cli-platform-android#7.0.1
│ │ ├─┬ #react-native-community/cli-tools#7.0.1
│ │ │ └── lodash#4.17.21 deduped
│ │ └── lodash#4.17.21 deduped
│ ├─┬ #react-native-community/cli-platform-ios#7.0.1
│ │ ├─┬ #react-native-community/cli-tools#7.0.1
│ │ │ └── lodash#4.17.21 deduped
│ │ └── lodash#4.17.21 deduped
│ └─┬ #react-native-community/cli#7.0.3
│ ├─┬ #react-native-community/cli-hermes#6.3.0
│ │ └─┬ #react-native-community/cli-platform-android#6.3.0
│ │ └── lodash#4.17.21 deduped
│ ├─┬ #react-native-community/cli-tools#6.2.0
│ │ └── lodash#4.17.21 deduped
│ └── lodash#4.17.21 deduped
├─┬ styled-components#5.3.3
│ └─┬ babel-plugin-styled-components#2.0.2
│ └── lodash#4.17.21 deduped
├─┬ ts-jest#26.5.6
│ └── lodash#4.17.21 deduped
├─┬ webpack-bundle-analyzer#4.5.0
│ └── lodash#4.17.21 deduped
├─┬ webpack-dev-server#3.11.3
│ ├─┬ http-proxy-middleware#0.19.1
│ │ └── lodash#4.17.21 deduped
│ └─┬ portfinder#1.0.28
│ └─┬ async#2.6.4
│ └── lodash#4.17.21 deduped
├─┬ webpack-manifest-plugin#2.2.0
│ └── lodash#4.17.21 deduped
└─┬ workbox-webpack-plugin#6.4.2
└─┬ workbox-build#6.4.2
└── lodash#4.17.21 deduped
As you can see, all the modules are devDependencies except one which is #sentry/react-native (our webapp is also a react-native app), I doubt this is the reason why lodash get bundled, but I have raised an issue sentry-wizard/issues/182 and sentry-react-native/issues/2409.
Also, the web just bundle in dev environment, but there is no node_modules folder distributed in the production build, this is how webpack work, so this whole lodash is a mystery.
Why does the whole lodash get also imported and how can I improve my bundle?
The other packages in your image are in fact not the lodash package, but other individual packaged lodash functions.
See: https://www.npmjs.com/package/lodash.debounce
If you haven't added them to your package.json, then it is likely that your dependencies did and they are bundled alongside lodash.
I personally would recommend not to optimize these imports, since they are quite small in comparison, but attempt to use tree-shakeable lodash imports, which would help much more.
i.e.
Do not
import {keyBy} from 'lodash' // Bundled as lodash.js. Though there are babel plugins that would convert this to imports below.
Do
import keyBy from 'lodash/keyBy' // Bundled as keyBy.js. One of the small squares next to lodash.js
Doing so would eliminate bundling the complete lodash.js, which your application very likely doesn't completely utilize.
One used to be able to initialise a vue.js 2 project with webpack using "vue init webpack client". In vue.js 3 project, from my understanding, one needs to use "vue create" to create a new project. However, this does not initialise the project with webpack. I am not finding any example of a command replacing the one used in vue.js 2, which could be used to initialise a vue.js 3 project, but only manual steps.
vue create scaffolds a Vue project that uses Webpack under the hood. Webpack is a build dependency of #vue/cli-service. You'll see it listed when running npm list webpack from the root of your scaffolded project:
$ npm list webpack
vue3-proj#0.1.0 /Users/tony/src/tmp/vue3-proj
├─┬ #vue/cli-plugin-babel#4.5.12
│ ├─┬ babel-loader#8.2.2
│ │ └── webpack#4.46.0 deduped
│ ├─┬ cache-loader#4.1.0
│ │ └── webpack#4.46.0 deduped
│ ├─┬ thread-loader#2.1.3
│ │ └── webpack#4.46.0 deduped
│ └─┬ webpack#4.46.0
│ └─┬ terser-webpack-plugin#1.4.5
│ └── webpack#4.46.0 deduped
├─┬ #vue/cli-plugin-eslint#4.5.12
│ ├─┬ eslint-loader#2.2.1
│ │ └── webpack#4.46.0 deduped
│ └── webpack#4.46.0 deduped
└─┬ #vue/cli-service#4.5.12
├─┬ #intervolga/optimize-cssnano-plugin#1.0.6
│ └── webpack#4.46.0 deduped
├─┬ #soda/friendly-errors-webpack-plugin#1.8.0
│ └── webpack#4.46.0 deduped
├─┬ #vue/preload-webpack-plugin#1.1.2
│ └── webpack#4.46.0 deduped
├─┬ copy-webpack-plugin#5.1.2
│ └── webpack#4.46.0 deduped
├─┬ css-loader#3.6.0
│ └── webpack#4.46.0 deduped
├─┬ file-loader#4.3.0
│ └── webpack#4.46.0 deduped
├─┬ html-webpack-plugin#3.2.0
│ └── webpack#4.46.0 deduped
├─┬ mini-css-extract-plugin#0.9.0
│ └── webpack#4.46.0 deduped
├─┬ terser-webpack-plugin#2.3.8
│ └── webpack#4.46.0 deduped
├─┬ url-loader#2.3.0
│ └── webpack#4.46.0 deduped
├─┬ vue-loader#15.9.6
│ └── webpack#4.46.0 deduped
├─┬ webpack-dev-server#3.11.2
│ ├─┬ webpack-dev-middleware#3.7.3
│ │ └── webpack#4.46.0 deduped
│ └── webpack#4.46.0 deduped
└── webpack#4.46.0 deduped
I have created a debian virtual machine where I have installed meteor version 1.4.2.
I am working on the simple-todos meteor tutorial, blaze view.
I have done everything on step 2 [several times; even to the point of deleting and starting over many times]; I've even done straight c&p of all the code into the various files. I have spent several hours searching google; git-hub, and stackoverflow and have not found anything that seems to relate to my problem.
When I look at the app in the browser, the page is blank ... when I look in the console I have the following error code:
Uncaught Error: Cannot find module './template.body.js'
at require (http://localhost:3000/packages/modules-runtime.js?hash=ab7e8d32b6c7b5a5fa7ae1b65e8225c4f9e30223:119:19) [this error continues with a lot more references and hashes, but I can't post more than 2 links]
If someone could at least point me in the right direction so I can continue to research this, I would be most grateful.
OK, that's weird... I replicated what you were seeing. It happens when you have meteor RUNNING while doing this coding, so it is doing live code update, but the module is not being built/included properly.
All I did was STOP and restart Meteor. And it worked.
Not sure why it is not loading the modules in a rebuild and hot code push, but there you have it, that's the fix.
Here is my shell so you see what I did:
shaunst:~/workspace $ curl https://install.meteor.com/ | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7784 0 7784 0 0 23942 0 --:--:-- --:--:-- --:--:-- 23950
Downloading Meteor distribution
######################################################################## 100.0%
Meteor 1.4.2 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
To get started fast:
$ meteor create ~/my_cool_app
$ cd ~/my_cool_app
$ meteor
Or see the docs at:
docs.meteor.com
shaunst:~/workspace $ meteor create simple-todos
Created a new Meteor app in 'simple-todos'.
To run your new app:
cd simple-todos
meteor
If you are new to Meteor, try some of the learning resources here:
https://www.meteor.com/learn
shaunst:~/workspace $ cd simple-todos/
shaunst:~/workspace/simple-todos $ meteor npm install
simple-todos# /home/ubuntu/workspace/simple-todos
└─┬ meteor-node-stubs#0.2.3
├── assert#1.3.0
├─┬ browserify-zlib#0.1.4
│ └── pako#0.2.8
├─┬ buffer#4.5.1
│ ├── base64-js#1.1.2
│ ├── ieee754#1.1.6
│ └── isarray#1.0.0
├─┬ console-browserify#1.1.0
│ └── date-now#0.1.4
├── constants-browserify#1.0.0
├─┬ crypto-browserify#3.11.0
│ ├─┬ browserify-cipher#1.0.0
│ │ ├─┬ browserify-aes#1.0.6
│ │ │ ├── buffer-xor#1.0.3
│ │ │ └── cipher-base#1.0.2
│ │ ├─┬ browserify-des#1.0.0
│ │ │ ├── cipher-base#1.0.2
│ │ │ └─┬ des.js#1.0.0
│ │ │ └── minimalistic-assert#1.0.0
│ │ └── evp_bytestokey#1.0.0
│ ├─┬ browserify-sign#4.0.0
│ │ ├── bn.js#4.11.1
│ │ ├── browserify-rsa#4.0.1
│ │ ├─┬ elliptic#6.2.3
│ │ │ ├── brorand#1.0.5
│ │ │ └── hash.js#1.0.3
│ │ └─┬ parse-asn1#5.0.0
│ │ ├─┬ asn1.js#4.5.2
│ │ │ └── minimalistic-assert#1.0.0
│ │ ├─┬ browserify-aes#1.0.6
│ │ │ ├── buffer-xor#1.0.3
│ │ │ └── cipher-base#1.0.2
│ │ └── evp_bytestokey#1.0.0
│ ├─┬ create-ecdh#4.0.0
│ │ ├── bn.js#4.11.1
│ │ └─┬ elliptic#6.2.3
│ │ ├── brorand#1.0.5
│ │ └── hash.js#1.0.3
│ ├─┬ create-hash#1.1.2
│ │ ├── cipher-base#1.0.2
│ │ ├── ripemd160#1.0.1
│ │ └── sha.js#2.4.5
│ ├── create-hmac#1.1.4
│ ├─┬ diffie-hellman#5.0.2
│ │ ├── bn.js#4.11.1
│ │ └─┬ miller-rabin#4.0.0
│ │ └── brorand#1.0.5
│ ├── inherits#2.0.1
│ ├── pbkdf2#3.0.4
│ ├─┬ public-encrypt#4.0.0
│ │ ├── bn.js#4.11.1
│ │ ├── browserify-rsa#4.0.1
│ │ └─┬ parse-asn1#5.0.0
│ │ ├─┬ asn1.js#4.5.2
│ │ │ └── minimalistic-assert#1.0.0
│ │ ├─┬ browserify-aes#1.0.6
│ │ │ ├── buffer-xor#1.0.3
│ │ │ └── cipher-base#1.0.2
│ │ └── evp_bytestokey#1.0.0
│ └── randombytes#2.0.3
├── domain-browser#1.1.7
├── events#1.1.0
├─┬ http-browserify#1.7.0
│ ├── Base64#0.2.1
│ └── inherits#2.0.1
├── https-browserify#0.0.1
├── os-browserify#0.2.1
├── path-browserify#0.0.0
├── process#0.11.2
├── punycode#1.4.1
├── querystring-es3#0.2.1
├─┬ readable-stream#2.0.6
│ ├── core-util-is#1.0.2
│ ├── inherits#2.0.1
│ ├── isarray#1.0.0
│ ├── process-nextick-args#1.0.6
│ └── util-deprecate#1.0.2
├─┬ stream-browserify#2.0.1
│ └── inherits#2.0.1
├── string_decoder#0.10.31
├── timers-browserify#1.4.2
├── tty-browserify#0.0.0
├─┬ url#0.11.0
│ ├── punycode#1.3.2
│ └── querystring#0.2.0
├─┬ util#0.10.3
│ └── inherits#2.0.1
└─┬ vm-browserify#0.0.4
└── indexof#0.0.1
shaunst:~/workspace/simple-todos $ meteor --port 8080
[[[[[ ~/workspace/simple-todos ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:8080/
=> Meteor server restarted
=> Meteor server restarted
=> Meteor server restarted
=> Meteor server restarted
=> Client modified -- refreshing (x3)
=> Meteor server restarted
=> Meteor server restarted
=> Client modified -- refreshing^C
shaunst:~/workspace/simple-todos $ ^C
shaunst:~/workspace/simple-todos $ meteor --port 8080
[[[[[ ~/workspace/simple-todos ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:8080/
=> Client modified -- refreshing (x2)
I'm experiencing the same.
I did as user Shaun Stoltz suggested (restart Meteor), and it did work. But then I added more files to the imports folder, and the error recurred, now referencing the new file missing 'template...'.
I gave Meteor another restart, and the build worked again.It seems that meteor omits the new files from the build while it's watching. Only upon restart the new files get included. This is a real nuisance as while following contemporary componental approach, i will be creating many small files, and restarting Meteor repeatedly is going to exhaust.
Are there other users experiencing this issue?
Set your project's Meteor version to a previous one:
meteor update --release 1.4.1.3
(Thanks to diaconutheodor)
Source
I am running meteor on a Mac using blaze templating. I have done the following steps and it has worked:
make sure that the import statement is in client/main.js and not in
server/main.js
make sure that 'blaze-html-templates' is installed
ensure that imports folder is typed correctly
Restart the server
If everything else fails, you can reset your project using 'meteor reset'
Hope this helps.
I am trying to execute a sample script that reads a CSV file. I copied the sample from this page:
http://www.adaltas.com/projects/node-csv/
I get this error:
csv()
^
TypeError: object is not a function
at Object.<anonymous> (/Users/paulchernoch/Documents/Chris Leung/read-csv-test.js:8:1)
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 Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
The sample code (modified to use my file names):
var csv = require('csv');
var fs = require('fs');
csv()
.from.stream(fs.createReadStream(__dirname+'/f1dcca4e8c5f76b3.csv'))
.to.path(__dirname+'/test.txt')
.transform( function(row){
return row;
})
.on('record', function(row,index){
console.log('#'+index+' ' /* +JSON.stringify(row) */);
})
.on('end', function(count){
console.log('Number of lines: '+count);
})
.on('error', function(error){
console.log(error.message);
});
I invoked the script from the command line like this:
> node read-csv-test.js
To verify whether I had the proper CSV module installed, I used the node package manager:
$ npm list
/Users/paulchernoch
├─┬ csv#0.4.0
│ ├── csv-generate#0.0.4
│ ├── csv-parse#0.0.3
│ ├── csv-stringify#0.0.2
│ └── stream-transform#0.0.2
├─┬ express#4.3.0
│ ├─┬ accepts#1.0.1
│ │ ├── mime#1.2.11
│ │ └── negotiator#0.4.3
│ ├── buffer-crc32#0.2.1
│ ├── cookie#0.1.2
│ ├── cookie-signature#1.0.3
│ ├── debug#0.8.1
│ ├── escape-html#1.0.1
│ ├── fresh#0.2.2
│ ├── merge-descriptors#0.0.2
│ ├── methods#1.0.0
│ ├── parseurl#1.0.1
│ ├── path-to-regexp#0.1.2
│ ├─┬ proxy-addr#1.0.0
│ │ └── ipaddr.js#0.1.2
│ ├── qs#0.6.6
│ ├── range-parser#1.0.0
│ ├─┬ send#0.3.0
│ │ ├── debug#0.8.0
│ │ └── mime#1.2.11
│ ├── serve-static#1.1.0
│ ├─┬ type-is#1.2.0
│ │ └── mime#1.2.11
│ └── utils-merge#1.0.0
├─┬ jade#1.3.1
│ ├── character-parser#1.2.0
│ ├── commander#2.1.0
│ ├─┬ constantinople#2.0.0
│ │ └─┬ uglify-js#2.4.13
│ │ ├── async#0.2.10
│ │ ├─┬ optimist#0.3.7
│ │ │ └── wordwrap#0.0.2
│ │ ├─┬ source-map#0.1.33
│ │ │ └── amdefine#0.1.0
│ │ └── uglify-to-browserify#1.0.2
│ ├── mkdirp#0.3.5
│ ├─┬ monocle#1.1.51
│ │ └─┬ readdirp#0.2.5
│ │ └─┬ minimatch#0.3.0
│ │ ├── lru-cache#2.5.0
│ │ └── sigmund#1.0.0
│ ├─┬ transformers#2.1.0
│ │ ├─┬ css#1.0.8
│ │ │ ├── css-parse#1.0.4
│ │ │ └── css-stringify#1.0.5
│ │ ├─┬ promise#2.0.0
│ │ │ └── is-promise#1.0.1
│ │ └─┬ uglify-js#2.2.5
│ │ ├─┬ optimist#0.3.7
│ │ │ └── wordwrap#0.0.2
│ │ └─┬ source-map#0.1.33
│ │ └── amdefine#0.1.0
│ └─┬ with#3.0.0
│ └─┬ uglify-js#2.4.13
│ ├── async#0.2.10
│ ├─┬ optimist#0.3.7
│ │ └── wordwrap#0.0.2
│ ├─┬ source-map#0.1.33
│ │ └── amdefine#0.1.0
│ └── uglify-to-browserify#1.0.2
├─┬ mariasql#0.1.20
│ └── lru-cache#2.3.1
└─┬ stylus#0.45.1
├── css-parse#1.7.0
├── debug#0.8.1
├─┬ glob#3.2.11
│ ├── inherits#2.0.1
│ └─┬ minimatch#0.3.0
│ ├── lru-cache#2.5.0
│ └── sigmund#1.0.0
├── mkdirp#0.3.5
└── sax#0.5.8
What am I missing? I am running MAC OS X 10.6.8. I installed node using Homebrew. I have successfully used node and javascript on Windows, but this is my very first attempt to use node on a MAC. (The ultimate goal is to parse CSV files and load them into MariaDb.)
Its not clear where you got your sample code, but it is probably no longer valid - a new version of the module (0.4) was released recently with a very different API. You can either check out the new documentation at the project's GitHub page or install an older version by:
npm remove csv
npm install csv#0.3.7
0.3.7 has the API you appear to be working against, but you can of course go farther back if necessary.
I'm starting to develop with node.j,I meet an issue regarding the using of the module 'formidable'.
I have this error:
Error: Cannot find module 'formidable'
Here is the module list installed using 'npm ls installed' :
├─┬ express#2.5.9
│ ├── connect#1.8.7
│ ├── mime#1.2.4
│ ├── mkdirp#0.3.0
│ └── qs#0.4.2
├── formidable#1.0.9
├─┬ node-inspector#0.1.10
│ ├── paperboy#0.0.3
│ └─┬ socket.io#0.8.7
│ ├── policyfile#0.0.4
│ ├── redis#0.6.7
│ └─┬ socket.io-client#0.8.7
│ ├── uglify-js#1.0.6
│ ├── websocket-client#1.0.0
│ └── xmlhttprequest#1.2.2
├─┬ npm#1.1.21
│ ├── abbrev#1.0.3
│ ├── archy#0.0.2
│ ├── block-stream#0.0.5
│ ├── chownr#0.0.1
│ ├── fstream#0.1.18
│ ├─┬ fstream-npm#0.0.6
│ │ └── fstream-ignore#0.0.5
│ ├── graceful-fs#1.1.8
│ ├── inherits#1.0.0
│ ├── ini#1.0.2
│ ├── lru-cache#1.0.5
│ ├── minimatch#0.2.2
│ ├── mkdirp#0.3.0
│ ├─┬ node-gyp#0.4.1
│ │ ├── ansi#0.0.4
│ │ └── glob#3.1.9
│ ├── node-uuid#1.3.3
│ ├── nopt#1.0.10
│ ├── proto-list#1.0.0
│ ├── read#0.0.2
│ ├── request#2.9.153
│ ├── rimraf#2.0.1
│ ├── semver#1.0.13
│ ├── slide#1.1.3
│ ├── tar#0.1.13
│ ├── uid-number#0.0.3
│ └── which#1.0.5
└─┬ socket.io#0.9.6
├── policyfile#0.0.4
├── redis#0.6.7
└─┬ socket.io-client#0.9.6
├─┬ active-x-obfuscator#0.0.1
│ └── zeparser#0.0.5
├── uglify-js#1.2.5
├─┬ ws#0.4.14
│ ├── commander#0.5.2
│ └── options#0.0.3
└── xmlhttprequest#1.2.2
I add that it is the only module who generate this error.
Also, I don't really understand the way are encapsulated some module, it appears that npm is installing the module directly in the directory I'm using the module installation command, and I notice that formidable has been installed in the express/connect/ module on its first installation.
Can you give me more information about the module installation tree.
Thank for your replies
Cheers
The accepted answer looks very comprehensive and correct, but this worked for me:
npm install -d
d stands for dependencies (I think)
To understand module resolution, have a look at the Modules documentation, especially Loading from node_modules Folders.
For example, if the file at '/home/ry/projects/foo.js' called require('bar.js'), then node would look in the following locations, in this order:
/home/ry/projects/node_modules/bar.js
/home/ry/node_modules/bar.js
/home/node_modules/bar.js
/node_modules/bar.js
NPM takes advantage of this by installing modules into:
./node_modules/{module}
So, when you use npm install formidable, it will create and install the module into:
./node_modules/formidable
But, this means that only scripts within the current directory, including sub-directories, will succeed in using require('formidable'):
./foo.js
./lib/bar.js
./src/baz.js
./src/sub/qux.js
You can however install modules as "global," but you have to explicitly ask for it with -g or --global:
npm install -g formidable
Then, any script on the system should be able to require('formidable').
As for the tree output, you current have 5 installed modules available from the current directory:
express
formidable
node-inspector
npm
socket.io
Everything else in the tree is a list of these modules' dependencies, and their dependencies, etc., but only these 5 are available for require(...) within your scripts.