amplify configure Error: can't find module - amazon-web-services

Following https://docs.amplify.aws/start/getting-started/installation/q/integration/react-native/#option-2-follow-the-instructions
I did:
npm install -g #aws-amplify/cli
Then followed with:
amplify configure
I have Node.js, git, and npm all installed with versions that should be compatible.
After doing amplify configure:
I receive the following error:
internal/modules/cjs/loader.js:883 throw err; ^
Error: Cannot find module
'C:\Users\Dev\AppData\Roaming\npm\node_modules\ #aws-amplify\cli\lib\run.js'
←[90m at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:880:15)←[39m ←[90m at
Function.Module._load (internal/modules/cjs/loader.js:725:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:72:12)←[39m ←[90m at
internal/main/run_main_module.js:17:47←[39m { code:
←[32m'MODULE_NOT_FOUND'←[39m, requireStack: [] }
I'm on Windows 10
Any help would be appreciated thanks
Edit:
Also just another note. When I try to reinstall the -g #aws-amplify/cli it says it is already installed:
Here are the first two lines:
npm ERR! code EEXIST
npm ERR! path
C:\Users\Dev\AppData\Roaming\npm\node_modules\ #aws-amplify\cli\lib\run.js
So, the paths appear to be the same.
Edit:
Although when I do cd #aws-amplify it returns:
The system cannot find the path specified.
this is after I am already successfully in the node_modules folder
And navigating into the npm folder there are three things labeled amplify. A file, Windows Command Script, and Windows PowerShell.
So has the installation process changed. Now that I've located these files how is AWS Amplify CLI supposed to work so I can set up with amplify configure
Solution:
I put this in one of the comments below but figured people may want to try this in the future if they come across the same error.
"I eventually fixed it by first editing the PATH in my system and then doing a --force reinstall of the files. My guess is something went wrong during the initial installation because it worked after I overwrote the previous files, and I noticed some of the files were missing before I did it. Not sure why it didn't work during my initial installation though."

I hope it's not too late. Have you tried:
npm install aws-amplify
Regards

Related

Does AWS inspector include package vulnerabilities that are in yarn.lock but not installed?

When using AWS inspector for ECR images, the results mentioned vulnerabilities that don't seem to be installed on the image.
This article from snyk discusses how AWS Inspector is using Snyk to help with it's detecting.
Question:
My question is does AWS inspector or Snyk include package vulnerabilities that are in yarn.lock but not installed?
Is this the convention for other package inspectors, to include vulnerabilities in packages that aren't installed but are listed as dependencies?
This doesn't make sense, why would it be a vulnerability if the package is not actually installed.
More Info:
The reason I don't think the package is installed is because when I run npm list (docs) the vulnerable package is not listed.
Also when I test locally I don't see a node_models folder with the suspected package. I do see it listed in a yarn.lock file.
(The suspected package is a devDependency of a dependency of a dependency of a package that is installed globally)
Side Notes:
When I run npm audit (docs) I don't see any security issues listed. npm audit has it's own issues with listing vulnerabilities that may not be a real issue (see here and enter link description here), but at least it's not listing packages that aren't even installed.
This question may be dependent on this question, regarding devDependencies being installed when installing a package (globally).
We solved this problem by manually deleting all yarn.lock files from our docker images as the last step:
RUN yarn install --production --silent --pure-lockfile --cache-folder /usr/app/yarn-cache \
# get rid of all yarn.lock files as the AWS Inspector thinks they contain vulnerabilities
&& rm -rf ./yarn-cache \
&& find . -type f -name 'yarn.lock' -delete
obviously the bit about the --cache-folder may not be relevant to you, we just keep the cache around through our multistage builds to speed things up

Expo 36: Unable to resolve "../../data" from "node_modules/css-tree/lib/syntax/default.js"

Got this error after upgrading expo 35 to 36.
Unable to resolve "../../data" from "node_modules/css-tree/lib/syntax/default.js"
I've tried to yarn add css-tree. This error was gone, but then module react-native-svg started giving the same error with it's included css-tree module.
I've tried to upgrad expo-cli to the latest version and restart terminal. I'm running builds with expo start -c to ensure cache doesn't affect it. I've tried to delete app from the simulator. Still the same.
I've been able to apply a temporary fix by upgrading css-tree dependency inside the react-native-svg, but this is a really wrong way to go as far as I know.
Any ideas?
I found a way to fix it, you just need to install css-tree package on your project.
npm install css-tree
or if you are using yarn
yarn add css-tree
as of SDK 38 this problem still shows up and seems to be caused by a version resolution issue where Yarn/NPM understands 1.0.0-alpha9 to be more recent then 1.0.0-alpha.37 (which is the minimum requirement for react-native-svg-transformer).
Using the resolutions override with Yarn 2 or Yarn 1 as follows fixed it for me with no other extra tweaking.
"resolutions": {
"css-tree": "1.0.0-alpha.39"
}
"resolutions": {
"**/css-tree": "1.0.0-alpha.39"
}
I needed to use react-native-svg-icon ran into the exact same issue.
I'm also running Expo SDK v36, and when it suggested me to install react-native-svg via the cli : expo install react-native-svg, that's what I did; there were errors with this approach most notably when you use import { Circle } from 'react-native-svg' (for newer versions of the package) and 'expo' sometimes doesn't install the package.json properly so I found installing the same version of react-native-svg w/o expo cli was the best approach.
Try running this npm i react-native-svg#9.13.3
Fixed it for me.
This issue occurred for me when building my app using MS App Center, the App Center build scripts picked up on an old yarn.lock file in the project using the line if [ -f yarn.lock ]; then { yarn install && yarn list --depth=0; } else npm install; fi however I normally use npm rather than Yarn.
Removing this file allowed the build to use npm which resolved this issue.

Ember build issue: "Cannot use the decorators and decorators-legacy plugin together"

I have recently encountered an issue with building my ember project with bitbucket pipelines:
+ ember build --environment="production"
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
Building
Environment: production
cleaning up
cleaning up...
Build Error (broccoli-persistent-filter:Babel > [Babel: ember-data]) in ember-data/adapters/json-api.js
Cannot use the decorators and decorators-legacy plugin together
I am currently using ember-cli version 3.8.1.
The issue occurs with all build environments, not just production.
What baffles me is that no new npm package or ember addon was added between last successful build and the ones that have been failing since - and now if I re-run the successful build, that will also fail.
I have gone back in the commit history to a commit that worked, then fast-forward into the present step-by-step - always deleting the node_modules and reinstalling the packages. It always works locally, but it will always fail when the pipeline is run.
I have also tried updating my docker image.
I have already gone through and tried the solutions listed here - but it seems like they have already been addressed in version 3.8.1.
Also, if it is any help, this is my bitbucket-pipelines.yml:
pipelines:
branches:
master:
- step:
name: Building Ember Project
script:
- npm install
- npm install firebase-tools
- ember build --environment="production"
- step:
trigger: manual
deployment: production
name: Deploy to Production
script:
- firebase use prod
- firebase deploy --non-interactive --token ${FIREBASE_TOKEN}
Thank you all in advance!
This sounds like a sub-dependency changing on the fly under the hood. Do you have an npm or yarn lockfile commited as part of your repo? Lockfiles are specifically designed to keep from hitting snags like this
I have gone through the below errors,
Build error : “Cannot use the decorators and decorators-legacy plugin together”
Build error: 'relationshipStateFor' is not exported by -private\system\record-data-for.js
On browser got Expected store.createRecordDataFor to be implemented but it wasn't.
Reason for the above error is with ember-data addon and mismatch in ember-cli version installed for my project.
In your package.json, You might have defined ember-cli version( "ember-cli": "^3.11.0",) with ^ symbol this means it will install latest version which is less than the 4.0.0. So your ember-cli in node_modules might be installed to the latest version.
The above mentioned error is caused by the ember-cli version which was installed and pointed to 3.15.0. So I have removed the ^ and updated "ember-cli": "3.11.0", and removed node_modules and did npm install that solves the above problem.

npm install does not download one specific file

I have created one yo generator and I can see the code is available in github and also showing in yo generator list.
Its working perfectly when I do npm install to download the generator code into my local machine and also when scaffold application using yo command.
Only problem is one of my file (systemjs.config.js) which is in the /generator/template folder is not getting downloaded niter from npm install nor when I scaffold application using yo command.
generator link git link to generator
command to download and scaffold from yo generator
npm install -g yo
npm install -g generator-angular2-with-router
yo angular2-with-router
The problem was occurring due to .gitingore file which was ignoring all the .js files as the project is in typescript. I was ignoring all my .js and .js.map files in my git ignore file
as systemjs.config.js file is a js file, its has been ignored by publish or something was happening with npm and it was not downloading.
Now I changed my .gitignore file and so that specific .js and .js.map file will be ignored and it resolved my problem.

Uncaught Error: Could not find module `ember-qunit`. Odd out-of-the-box ember-cli behavior

I believe I may have an environment issue here, but I'm quite stuck as to what I can to do resolve it. I created an ember-cli project, committed it to git, added a few things. I ran the typical npm install && bower install commands and tried ember s.
Although the site loads fine, when I browsed to the http://localhost:4200/tests/ to ensure qunit was up and running, I had a few errors.
Uncaught Error: Could not find module `ember-qunit` imported from `ember-project/tests/test-helper
Uncaught Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js".
Immediately this raised a red flag, as I have created several ember projects before and not run into similar issues. I had my partners (I'm in school) checkout the project, run the npm install && bower install && ember s and the qunit module worked fine for them!
I've tried to git clone a new repo several times, I've even went so far as to uninstall node and bower completely, but no matter what I try I cannot seem to pull up a normal /tests checkout.
My partners were both running VMs - Ubuntu and Debian, while I'm on a mac, but that seems like it shouldn't be too big of an issue, especially since I created the project!
I've looked several places for this (here, here, and here), but I cannot seem to come to a conclusion which works for me.
I do have an identical bower.json as the rest of my group. I've included the picture below of my file structure, my bower.json, and my tests/index.html.
screenshot
Here are some environment stats:
ember version: 1.13.13
node: 5.0.0
os: darwin x64
bower: 1.7.1
One thing that I did notice is a difference when I do this to see npm's version, but I'm not sure if that matters or not.
ember -v
npm: 2.14.10
npm -v
npm: 3.5.2
It appears to be a regression from the work in ember-cli beta. You can track the progress here https://github.com/ember-cli/ember-cli/issues/5411.
For now, you can add
app.import('bower_components/qunit/qunit/qunit.js');
app.import('bower_components/ember-qunit/ember-qunit.amd.js');
to ember-cli-build.js as a workaround.