Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"npm run env -s" doesn't create .env file #21

Closed
Mef45 opened this issue Dec 4, 2020 · 1 comment
Closed

"npm run env -s" doesn't create .env file #21

Mef45 opened this issue Dec 4, 2020 · 1 comment
Labels

Comments

@Mef45
Copy link

Mef45 commented Dec 4, 2020

Today i create new project through ngx-rocket cli, and when i print npm start in console, i'v got error

Module not found: Error: Can't resolve './.env' in '/home/mef45/devel/gitlab/taxsee-monitoring-frontend/src/environments'

    ERROR in src/environments/environment.ts:11:21 - error TS2307: Cannot find
module './.env' or its corresponding type declarations.

    11 import { env } from './.env';

If i rename env script to something else, eg: "dotenv": "ngx-scripts env ...", all works as expected

npm run env output is really weird

"npm run env" output
> taxsee-monitoring-frontend@1.0.0 env
> env

USER=mef45
npm_config_user_agent=npm/7.0.15 node/v15.0.1 linux x64
XDG_SEAT=seat0
SSH_AGENT_PID=1773
XDG_SESSION_TYPE=x11
LF_ICONS=tw=:st=:ow=:dt=:di=:fi=:ln=:or=:ex=:*.c=:*.cc=:*.clj=:*.coffee=:*.cpp=:*.css=:*.d=:*.dart=:*.erl=:*.exs=:*.fs=:*.go=:*.h=:*.hh=:*.hpp=:*.hs=:*.html=:*.java=:*.jl=:*.js=:*.json=:*.lua=:*.md=:*.php=:*.pl=:*.pro=:*.py=:*.rb=:*.rs=:*.scala=:*.ts=:*.vim=:*.cmd=:*.ps1=:*.sh=:*.bash=:*.zsh=:*.fish=:*.tar=:*.tgz=:*.arc=:*.arj=:*.taz=:*.lha=:*.lz4=:*.lzh=:*.lzma=:*.tlz=:*.txz=:*.tzo=:*.t7z=:*.zip=:*.z=:*.dz=:*.gz=:*.lrz=:*.lz=:*.lzo=:*.xz=:*.zst=:*.tzst=:*.bz2=:*.bz=:*.tbz=:*.tbz2=:*.tz=:*.deb=:*.rpm=:*.jar=:*.war=:*.ear=:*.sar=:*.rar=:*.alz=:*.ace=:*.zoo=:*.cpio=:*.7z=:*.rz=:*.cab=:*.wim=:*.swm=:*.dwm=:*.esd=:*.jpg=:*.jpeg=:*.mjpg=:*.mjpeg=:*.gif=:*.bmp=:*.pbm=:*.pgm=:*.ppm=:*.tga=:*.xbm=:*.xpm=:*.tif=:*.tiff=:*.png=:*.svg=:*.svgz=:*.mng=:*.pcx=:*.mov=:*.mpg=:*.mpeg=:*.m2v=:*.mkv=:*.webm=:*.ogm=:*.mp4=:*.m4v=:*.mp4v=:*.vob=:*.qt=:*.nuv=:*.wmv=:*.asf=:*.rm=:*.rmvb=:*.flc=:*.avi=:*.fli=:*.flv=:*.gl=:*.dl=:*.xcf=:*.xwd=:*.yuv=:*.cgm=:*.emf=:*.ogv=:*.ogx=:*.aac=:*.au=:*.flac=:*.m4a=:*.mid=:*.midi=:*.mka=:*.mp3=:*.mpc=:*.ogg=:*.ra=:*.wav=:*.oga=:*.opus=:*.spx=:*.xspf=:*.pdf=:*.nix=:
FILE=lf
npm_node_execpath=/home/mef45/.nvm/versions/node/v15.0.1/bin/node
SHLVL=0
BROWSER=google-chrome-stable
HOME=/home/mef45
OLDPWD=/home/mef45/devel/gitlab
DESKTOP_SESSION=i3
NVM_BIN=/home/mef45/.nvm/versions/node/v15.0.1/bin
npm_package_json=/home/mef45/devel/gitlab/taxsee-monitoring-frontend/package.json
NVM_INC=/home/mef45/.nvm/versions/node/v15.0.1/include/node
GTK_MODULES=gail:atk-bridge
npm_config_userconfig=/home/mef45/.npmrc
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
COLOR=0
NVM_DIR=/home/mef45/.nvm
npm_config_metrics_registry=https://registry.npmjs.org/
ASPNETCORE_ENVIRONMENT=Development
LOGNAME=mef45
WINDOWID=46137348
_=/home/mef45/.nvm/versions/node/v15.0.1/bin/npm
npm_config_prefix=/home/mef45/.nvm/versions/node/v15.0.1
XDG_SESSION_CLASS=user
USERNAME=mef45
TERM=st-256color
XDG_SESSION_ID=2
npm_config_cache=/home/mef45/.npm
WINDOWPATH=2
npm_config_node_gyp=/home/mef45/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
PATH=/home/mef45/devel/gitlab/taxsee-monitoring-frontend/node_modules/.bin:/home/mef45/devel/gitlab/node_modules/.bin:/home/mef45/devel/node_modules/.bin:/home/mef45/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/home/mef45/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/mef45/.nvm/versions/node/v15.0.1/bin:/home/mef45/spicetify-cli:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:/home/mef45/.dotnet/tools:/home/mef45/bin/:/home/mef45/.local/bin/i3cmds:/home/mef45/.local/bin/:/usr/local/go/bin:/home/mef45/.local/share/go/bin
GDM_LANG=en_US.UTF-8
npm_package_name=taxsee-monitoring-frontend
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:1
LANG=en_US.UTF-8
XDG_CURRENT_DESKTOP=i3
XDG_SESSION_DESKTOP=i3
XAUTHORITY=/run/user/1000/gdm/Xauthority
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
npm_lifecycle_script=env
SSH_AUTH_SOCK=/tmp/ssh-RSG7EO0V9hjP/agent.1618
PREFIX=/home/mef45/.nvm/versions/node/v15.0.1
SHELL=/bin/bash
GOPATH=/home/mef45/.local/share/go
npm_package_version=1.0.0
npm_lifecycle_event=env
QT_ACCESSIBILITY=1
GDMSESSION=i3
npm_config_host_prod=https://mef45.myjetbrains.com/youtrack
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
DEFAULT_NETWORK=enp3s0
XDG_VTNR=2
npm_config_init_module=/home/mef45/.npm-init.js
npm_config_globalconfig=/home/mef45/.nvm/versions/node/v15.0.1/etc/npmrc
GPG_TTY=not
PWD=/home/mef45/devel/gitlab/taxsee-monitoring-frontend
SPICETIFY_INSTALL=/home/mef45/spicetify-cli
npm_execpath=/home/mef45/.nvm/versions/node/v15.0.1/lib/node_modules/npm/bin/npm-cli.js
NVM_CD_FLAGS=
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
npm_command=run-script
I3SOCK=/run/user/1000/i3/ipc-socket.1618
TERMINAL=st
EDITOR=vi
ngx debug info
ngX-Rocket: 9.1.0
Node.js: v15.0.1
Npm: 7.0.15
OS: linux x64 4.19.0-12-amd64

Generated project options:
{
  "generator-ngx-rocket": {
    "version": "9.1.0",
    "props": {
      "location": "path",
      "strict": false,
      "skipInstall": false,
      "skipQuickstart": false,
      "initGit": true,
      "usePrefix": true,
      "appName": "taxsee monitoring frontend",
      "target": [
        "web"
      ],
      "pwa": true,
      "ui": "material",
      "layout": "side-menu",
      "auth": true,
      "lazy": true,
      "angulartics": true,
      "languages": [
        "en-US",
        "fr-FR"
      ],
      "analyticsProvider": "ga",
      "googleAnalyticsAccount": "UA-1234567-1",
      "tools": [
        "prettier",
        "hads",
        "compodoc",
        "jest",
        "puppeteer"
      ],
      "utility": [
        "lodash",
        "datefns"
      ],
      "deploy": "none",
      "projectName": "taxsee-monitoring-frontend",
      "packageManager": "npm",
      "mobile": [],
      "desktop": []
    }
  }
}

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.1.7
Node: 15.0.1
OS: linux x64

Angular: 10.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1002.0
@angular-devkit/build-angular   0.1001.7
@angular-devkit/core            10.2.0
@angular-devkit/schematics      10.1.7
@angular/cdk                    10.2.7
@angular/cli                    10.1.7
@angular/flex-layout            10.0.0-beta.32
@angular/material               10.2.7
@schematics/angular             10.1.7
@schematics/update              0.1001.7
rxjs                            6.6.3
typescript                      4.0.5
@sinedied
Copy link
Member

sinedied commented Jan 8, 2021

See ngx-rocket/generator-ngx-rocket#575, I don't know why it behaves like that on some systems but the npm script will be renamed to "write:env" to avoid this issue in the future.
You can safely do the same in your project.

@sinedied sinedied closed this as completed Jan 8, 2021
@sinedied sinedied added the bug label Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants